Package: htdig
Version: 1:3.1.6-11
Severity: important
Tags: patch

reopen 269080
thanks

Hi 

Sorry to bother you again with this. But the cron.daily script is stil
_NOT_ fixed. I'm not sure for which reason this wasn't fixed in the
latest release. I will explain again why this fix is needed.

In /etc/default/htdig you can set if you want or want not to run
htnotify in the daily script. All is well if this is set to "true", but
if it's not, then rundig will not be executed. 

This means, while the condition (for $RUN) is true the script runs until
all is done. While the condition (for $RUN) is false $RUNSCRIPT will not
be executed, because $RUNSCRIPT doesn't come in place when it's part of
the wrong loop. This leads to the situation that the script exits after
it has tested $RUN is false (because of there isn't any instruction
after this is done). 

Here is the patch (long form) to get an overview:
#########################################################################
--- /root/htdig/htdig.dpkg-dist 2005-02-11 00:47:18.000000000 +0100
+++ /root/htdig/htdig   2004-08-30 19:25:28.000000000 +0200
@@ -1,35 +1,36 @@
#!/bin/sh
 

if ! lockfile-create /var/run/htdig.cron; then
    # Another htdig indexing cronjob is already running
    exit 0
fi
             
lockfile-touch /var/run/htdig.cron &
# Save the PID of the lockfile-touch process
BADGER="$!"
                
FILEREF="/etc/default/htdig"
RUNSCRIPT="/usr/bin/rundig"
LIBDIR="/var/lib/htdig"
REFRESH="$LIBDIR/full_refresh_needed"
if [ -x $RUNSCRIPT ]; then
        if [ -r $FILEREF ]; then
                RUN=$(awk '/^run_htnotify/ {print $3}' $FILEREF)
                if [ "$RUN" = "true" ]; then
                        PARAM=""
                        if [ -d $LIBDIR ]; then
                                if [ -r $REFRESH ]; then
                                        PARAM=" -i"
                                        rm -f $REFRESH
                                fi
                        fi
-                       PARAM="$PARAM -a"
-                       $RUNSCRIPT $PARAM > /dev/null
-               fi
+
+               fi
+               PARAM="$PARAM -a"
+               $RUNSCRIPT $PARAM > /dev/null
        fi
fi

kill "${BADGER}"
lockfile-remove /var/run/htdig.cron
#########################################################################

Another problem, i'm not sure if it's a problem or not, is PARAM="" .
It's only set if $RUN is true. Maybe this needs to be set before we test
for $RUN. Because if $RUN is false we call PARAM="$PARAM -a" and this
without to set $PARAM before.

I haven't a problem, if I use bash. But i'm not sure, if this may be a
problem with other shells. For the case it's a problem or just bad we
should set PARAM="" at the begin of the script.

BTW, htnotify is run within rundig, and i'm not sure if it only runs if
we call "rundig -i". As i understand "-i", it's only to do a full
refresh. But this isn't well-defined in the documentation. And if it's
the case, then "run_htnotify" has no effect on htnotify and we can
recycle these cron scripts. 

Then we should bring in place:
+ a weekly script, which touchs $REFRESH 
+ a daily script, which runs rundig and does the refresh. 

But run_htnotify in /etc/default/htdig is useless and should be removed.
Don't nail me down to this, i may be wrong. Upstream should shed some
light on this.

I hope everybody can understand this and sorry for this detailed report. I
didn't want to write a book.

THX
Carsten Luedtke

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.8.1
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages htdig depends on:
ii  debconf [debconf-2.0]       1.4.30.11    Debian configuration management sy
ii  gawk                        1:3.1.4-2    GNU awk, a pattern scanning and pr
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libdb2                      2:2.7.7.0-9  The Berkeley database routines (ru
ii  libgcc1                     1:3.4.3-6    GCC support library
ii  libstdc++5                  1:3.3.5-8    The GNU Standard C++ Library v3
ii  lockfile-progs              0.1.10       Programs for locking and unlocking
ii  perl                        5.8.4-6      Larry Wall's Practical Extraction 
ii  sed                         4.1.2-8      The GNU sed stream editor
ii  zlib1g                      1:1.2.2-3    compression library - runtime

-- debconf information:
* htdig/keep-databases: false
* htdig/generate-databases: true
  htdig/dblocation-changed:
* htdig/announce_package_split:
  htdig/remove-databases: false
* htdig/run-htnotify: false
--- /root/htdig/htdig.dpkg-dist 2005-02-11 00:47:18.000000000 +0100
+++ /root/htdig/htdig   2004-08-30 19:25:28.000000000 +0200
@@ -25,9 +25,10 @@
                                        rm -f $REFRESH
                                fi
                        fi
-                       PARAM="$PARAM -a"
-                       $RUNSCRIPT $PARAM > /dev/null
-               fi
+                       
+               fi      
+               PARAM="$PARAM -a"
+               $RUNSCRIPT $PARAM > /dev/null
        fi
 fi
 

Reply via email to