tags 386359 patch
stop

Here is a patch that seems to fix bug 386359. I have attached both the
regular patch and a dpatch-ified version which should be usable as a
drop-in replacement for <debian/patches/crawl-rules.dpatch>. This patch
supercedes the existing fix for bug 366486.

I have sent the patch upstream to Joe Shaw but didn't wait for a
response before sending this message to the Debian bug tracker.

-Ted
--- tools/beagle-crawl-system.in	2006-09-07 19:40:46.000000000 +1000
+++ ../beagle-0.2.9/tools/beagle-crawl-system.in	2006-09-07 21:54:10.000000000 +1000
@@ -1,4 +1,5 @@
 #!/bin/sh
+set -e
 
 #
 # beagle-crawl-system
@@ -26,6 +27,10 @@
 # SOFTWARE.
 #
 
+if [ ! -x @sbindir@/beagle-build-index ] ; then
+    exit 0
+fi
+
 umask 022
 
 CRAWL_USER=beagleindex
@@ -37,33 +42,37 @@
 chown $CRAWL_USER $MONO_SHARED_DIR
 
 for crawl_file in @sysconfdir@/beagle/crawl-*; do 
-    unset CRAWL_ENABLED CRAWL_DISABLE_FILTERING CRAWL_RECURSIVE CRAWL_CACHE_TEXT CRAWL_ALLOW_PATTERNS CRAWL_DENY_PATTERNS CRAWL_PATHS CRAWL_INDEX_NAME
+    unset CRAWL_ENABLED CRAWL_DISABLE_FILTERING CRAWL_RECURSIVE CRAWL_CACHE_TEXT CRAWL_ALLOW_PATTERNS CRAWL_DENY_PATTERNS CRAWL_PATHS CRAWL_INDEX_NAME OPTIONS
 
     if [ -f $crawl_file ] ; then
 	. $crawl_file
 
-	if [ -n "$CRAWL_ENABLED" -a "$CRAWL_ENABLED" = "yes" ] ; then
-
-	    OPTIONS="`test -n "$CRAWL_DISABLE_FILTERING" -a "$CRAWL_DISABLE_FILTERING" = "yes" && \
-                     echo --disable-filtering`"
-
-	    OPTIONS="$OPTIONS `test -n "$CRAWL_RECURSIVE" -a "$CRAWL_RECURSIVE" = "yes" && \
-                     echo --recursive`"
+	if [ "$CRAWL_ENABLED" = "yes" ] ; then
 
-	    OPTIONS="$OPTIONS `test -n "$CRAWL_CACHE_TEXT" -a "$CRAWL_CACHE_TEXT" = "yes" && \
-                     echo --enable-text-cache`"
-
-	    OPTIONS="$OPTIONS `test -n "$CRAWL_ALLOW_PATTERNS" && \
-                     echo --allow-pattern $CRAWL_ALLOW_PATTERNS`"
-
-	    OPTIONS="$OPTIONS `test -n "$CRAWL_DENY_PATTERNS" && \
-                     echo --deny-pattern $CRAWL_DENY_PATTERNS`"
+	    if [ "$CRAWL_DISABLE_FILTERING" = "yes" ] ; then
+		OPTIONS="$OPTIONS --disable-filtering"
+	    fi
+
+	    if [ "$CRAWL_RECURSIVE" = "yes" ] ; then
+		OPTIONS="$OPTIONS --recursive"
+	    fi
+
+	    if [ "$CRAWL_CACHE_TEXT" = "yes" ] ; then
+		OPTIONS="$OPTIONS --enable-text-cache"
+	    fi
+
+	    if [ -n "$CRAWL_ALLOW_PATTERNS" ] ; then
+		OPTIONS="$OPTIONS --allow-pattern $CRAWL_ALLOW_PATTERNS"
+	    fi
+
+	    if [ -n "$CRAWL_DENY_PATTERNS" ] ; then
+		OPTIONS="$OPTIONS --deny-pattern $CRAWL_DENY_PATTERNS"
+	    fi
+
+	    if IONICE=`which ionice 2>/dev/null`; then
+		IONICE="$IONICE -c 3"
+	    fi
 	    
-	    IONICE=`which ionice 2>/dev/null`
-            if [ -n "$IONICE" ]; then
-                IONICE="$IONICE -c 3"
-            fi
-
 	    eval nice -n 19 $IONICE su -s /bin/bash $CRAWL_USER -c \"MONO_SHARED_DIR=$MONO_SHARED_DIR @sbindir@/beagle-build-index --target @localstatedir@/cache/beagle/indexes/$CRAWL_INDEX_NAME $OPTIONS $CRAWL_PATHS\" > /dev/null 2>&1
 	fi
     fi
#! /bin/sh /usr/share/dpatch/dpatch-run
## beagle-crawl-safely.dpatch by Ted Percival <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Exit if beagle-build-index is not available. Also exit on errors
## DP: (set -e) and redo option-adding to work with "set -e".

@DPATCH@

--- tools/beagle-crawl-system.in        2006-09-07 19:40:46.000000000 +1000
+++ tools/beagle-crawl-system.in        2006-09-07 21:54:10.000000000 +1000
@@ -1,4 +1,5 @@
 #!/bin/sh
+set -e
 
 #
 # beagle-crawl-system
@@ -26,6 +27,10 @@
 # SOFTWARE.
 #
 
+if [ ! -x @sbindir@/beagle-build-index ] ; then
+    exit 0
+fi
+
 umask 022
 
 CRAWL_USER=beagleindex
@@ -37,33 +42,37 @@
 chown $CRAWL_USER $MONO_SHARED_DIR
 
 for crawl_file in @sysconfdir@/beagle/crawl-*; do 
-    unset CRAWL_ENABLED CRAWL_DISABLE_FILTERING CRAWL_RECURSIVE 
CRAWL_CACHE_TEXT CRAWL_ALLOW_PATTERNS CRAWL_DENY_PATTERNS CRAWL_PATHS 
CRAWL_INDEX_NAME
+    unset CRAWL_ENABLED CRAWL_DISABLE_FILTERING CRAWL_RECURSIVE 
CRAWL_CACHE_TEXT CRAWL_ALLOW_PATTERNS CRAWL_DENY_PATTERNS CRAWL_PATHS 
CRAWL_INDEX_NAME OPTIONS
 
     if [ -f $crawl_file ] ; then
        . $crawl_file
 
-       if [ -n "$CRAWL_ENABLED" -a "$CRAWL_ENABLED" = "yes" ] ; then
-
-           OPTIONS="`test -n "$CRAWL_DISABLE_FILTERING" -a 
"$CRAWL_DISABLE_FILTERING" = "yes" && \
-                     echo --disable-filtering`"
-
-           OPTIONS="$OPTIONS `test -n "$CRAWL_RECURSIVE" -a "$CRAWL_RECURSIVE" 
= "yes" && \
-                     echo --recursive`"
+       if [ "$CRAWL_ENABLED" = "yes" ] ; then
 
-           OPTIONS="$OPTIONS `test -n "$CRAWL_CACHE_TEXT" -a 
"$CRAWL_CACHE_TEXT" = "yes" && \
-                     echo --enable-text-cache`"
-
-           OPTIONS="$OPTIONS `test -n "$CRAWL_ALLOW_PATTERNS" && \
-                     echo --allow-pattern $CRAWL_ALLOW_PATTERNS`"
-
-           OPTIONS="$OPTIONS `test -n "$CRAWL_DENY_PATTERNS" && \
-                     echo --deny-pattern $CRAWL_DENY_PATTERNS`"
+           if [ "$CRAWL_DISABLE_FILTERING" = "yes" ] ; then
+               OPTIONS="$OPTIONS --disable-filtering"
+           fi
+
+           if [ "$CRAWL_RECURSIVE" = "yes" ] ; then
+               OPTIONS="$OPTIONS --recursive"
+           fi
+
+           if [ "$CRAWL_CACHE_TEXT" = "yes" ] ; then
+               OPTIONS="$OPTIONS --enable-text-cache"
+           fi
+
+           if [ -n "$CRAWL_ALLOW_PATTERNS" ] ; then
+               OPTIONS="$OPTIONS --allow-pattern $CRAWL_ALLOW_PATTERNS"
+           fi
+
+           if [ -n "$CRAWL_DENY_PATTERNS" ] ; then
+               OPTIONS="$OPTIONS --deny-pattern $CRAWL_DENY_PATTERNS"
+           fi
+
+           if IONICE=`which ionice 2>/dev/null`; then
+               IONICE="$IONICE -c 3"
+           fi
            
-           IONICE=`which ionice 2>/dev/null`
-            if [ -n "$IONICE" ]; then
-                IONICE="$IONICE -c 3"
-            fi
-
            eval nice -n 19 $IONICE su -s /bin/bash $CRAWL_USER -c 
\"MONO_SHARED_DIR=$MONO_SHARED_DIR @sbindir@/beagle-build-index --target 
@localstatedir@/cache/beagle/indexes/$CRAWL_INDEX_NAME $OPTIONS $CRAWL_PATHS\" 
> /dev/null 2>&1
        fi
     fi

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to