summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2012-05-29 13:24:19 +0200
committerintrigeri <intrigeri@boum.org>2012-05-29 13:24:19 +0200
commit50fc67fe2595e4bad208cb14a75c33ed1218f2d7 (patch)
tree4fefd6532d22dcb014b4d0ca93c15cece857999a
parentd291b362395a6b61e1cc65742198db85b9115e10 (diff)
Ignore changes to $WATCHED_DIR itself.
This fixes the dreaded "sometimes sends empty reports" bug metche has had since forever. Implementation-wise, this requires making $FIND_OPTS initialized in context_config, as $WATCHED_DIR changes depending on the context (host or VServer). Closes: https://labs.riseup.net/code/issues/3933
-rwxr-xr-xmetche25
1 files changed, 16 insertions, 9 deletions
diff --git a/metche b/metche
index 7bc25bb..4bf511c 100755
--- a/metche
+++ b/metche
@@ -256,17 +256,14 @@ for pattern in $EXCLUDES; do
done
set +o noglob
-# How to use $FIND_OPTS:
-# - $FIND_OPTS should appear unquoted between:
-# . the (optional) target files and directories
-# . the (compulsory) action, such as -print or -exec
-# - 'set -o noglob' has to be run before any $FIND_OPTS use
-# - 'set +o noglob' has to be run after any $FIND_OPTS use
-FIND_OPTS=""
+# How to use $_FIND_OPTS:
+# - 'set -o noglob' has to be run before any $_FIND_OPTS use
+# - 'set +o noglob' has to be run after any $_FIND_OPTS use
+_FIND_OPTS=""
set -o noglob
-# DO NOT fix me: the final -or at the end of $FIND_OPTS is really needed
+# DO NOT fix me: the final -or at the end of $_FIND_OPTS is really needed
for pattern in $EXCLUDES; do
- FIND_OPTS="$FIND_OPTS -path */$pattern -prune -or"
+ _FIND_OPTS="$_FIND_OPTS -path */$pattern -prune -or"
done
set +o noglob
@@ -349,6 +346,16 @@ context_config() {
test -d "$WATCHED_DIR" || \
fatal "$WATCHED_DIR directory (built from WATCHED_DIR) does not exist."
+ # Initialize $FIND_OPTS -- how to use it:
+ # - 'set -o noglob' has to be run before any $FIND_OPTS use
+ # - 'set +o noglob' has to be run after any $FIND_OPTS use
+ # - $FIND_OPTS should appear unquoted between:
+ # . the (optional) target files and directories
+ # . the (compulsory) action, such as -print or -exec
+ set -o noglob
+ FIND_OPTS="-path $WATCHED_DIR -or $_FIND_OPTS"
+ set +o noglob
+
# Initialize WATCHED_PARENT
WATCHED_PARENT=`dirname $WATCHED_DIR`
if [ "$WATCHED_PARENT" != '/' ]; then