This one time, at band camp, Raja R Harinath said:
> Hi,
> 
> I fixed this locally by changing the 'start_daemon' line in
> /etc/init.d/clamav-freshclam (pseudo-patch, sorry I didn't save the
> original before editing ;-):
> 
> -  start_daemon $DAEMON -p $PIDFILE -d --quiet
> +  start_daemon -p $PIDFILE $DAEMON -p $PIDFILE -d --quiet
> 
> The first '-p' is to tell start_daemon where the PIDFILE is, and the
> second is to freshclam to tell it where to put the darn thing.  For
> some reason, the getopt in start_daemon() is confused by the -p that
> comes _after_ a non-option.

I messed with this for a couple of hours last night, and it turns out
it's a complicated mess.  The lsb init functions weren't parsing getopt
options correctly, and after banging my head against it for a while,
my friend finally realized it was because it was starting at the wrong
point in the argument list because of a previous getopt call.

So this means the right fix is twofold.  Change the freshclam init script
like so:

-  start_daemon $DAEMON -p $PIDFILE -d --quiet
+  start_daemon $DAEMON -- -p $PIDFILE -d --quiet

and change lsb/init-functions like so:

--- init-functions      2006-08-07 19:15:46.000000000 +0100
+++ /lib/lsb/init-functions     2006-08-09 00:28:10.000000000 +0100
@@ -33,6 +33,7 @@
     nice=0
     pidfile=/dev/null

+    OPTIND=1
     while getopts fn:p: opt ; do
         case "$opt" in
             f)  force=1;;
@@ -42,10 +43,11 @@
     done

     shift $(($OPTIND - 1))
-    [ "$1" = '--' ] && shift

     exec="$1"; shift

+    [ "$1" = '--' ] && shift
+
     if [ $force = 1 ]; then
         /sbin/start-stop-daemon --start --nicelevel $nice --quiet --startas 
$exec --pidfile /dev/null --oknodo -- "$@"
     elif [ $pidfile ]; then

Either myself or my friend who helped debug the lsb problem last night
are going to send the patch to lsb (there's more to it - some other
functions are affected as well).

I have the fixes for clamav committed locally, but since the fixes depend
on lsb being patched as well, I am going to hold off on uploading for
the moment.

Thanks for the report and the debugging.
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        [EMAIL PROTECTED] |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

Reply via email to