Bug#342644: restart fails in clamav-data.postinst

2005-12-11 Thread Marc Haber
On Sat, Dec 10, 2005 at 07:35:22PM +0100, Sebastiaan Couwenberg wrote:
 I've tested the postinst, but it does not work with the volatile
 clamav-daemon init script.
 
 The volatile version gives:
 Usage: /etc/init.d/clamav-daemon
 {start|stop|restart|force-reload|reload-log}
 
 While the Sarge version gives:
 Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload}
 
 It should work with both versions of the init script when you use:
 grep -q ^Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload

Thanks for spotting this.

 I've attached my working version with the above fix.

I have committed that version to svn, and built a new clamav-getfiles.

Can you try clamav-data 20051209.220100.1207.3 from volatile please?

Greetings
Marc

-- 
-
Marc Haber | I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things.Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#342644: restart fails in clamav-data.postinst

2005-12-11 Thread Sebastiaan Couwenberg
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marc Haber wrote:
 On Sat, Dec 10, 2005 at 07:35:22PM +0100, Sebastiaan Couwenberg wrote:
 
It should work with both versions of the init script when you use:
grep -q ^Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload
 
 Thanks for spotting this.

Your welcome.

 Can you try clamav-data 20051209.220100.1207.3 from volatile please?

I have three different systems where I use the volatile package, and it
worked fine on all.

 Greetings
 Marc

Regards,

Bas

- --
GnuPG: 0x77A975AD

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDnIwaRWRRA3epda0RAqhvAJ0fc+uSH+1qUsSuxyp38f9wdRyL8ACglSzw
j9OI/BihMutGIvJkXFwA4aI=
=PDHm
-END PGP SIGNATURE-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#342644: restart fails in clamav-data.postinst

2005-12-11 Thread Marc Haber
reassign #342644 clamav-getfiles
retitle #342644 clamav-data doesn't correctly restart clamav-daemon on sarge 
and volatile
tags #342644 confirmed pending
user [EMAIL PROTECTED]
usertags #342644 fixed-in-volatile
thanks

On Sun, Dec 11, 2005 at 09:29:14PM +0100, Sebastiaan Couwenberg wrote:
 Marc Haber wrote:
  Can you try clamav-data 20051209.220100.1207.3 from volatile please?
 
 I have three different systems where I use the volatile package, and it
 worked fine on all.

Very well. I'm going to upload the new clamav-getfiles to unstable
tomorrow, and a new clamav-data to unstable as soon as a new database
version appears.

clamav-data in volatile is already running on the new clamav-getfiles,
so the issue is already solved for volatile.

I'm reassigning this bug to clamav-getfiles so that it automatically
closes with the clamav-getfiles upload.

Greetings
Marc

-- 
-
Marc Haber | I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things.Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#342644: restart fails in clamav-data.postinst

2005-12-11 Thread Sebastiaan Couwenberg
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marc Haber wrote:
I have three different systems where I use the volatile package, and it
worked fine on all.
 
 Very well. I'm going to upload the new clamav-getfiles to unstable
 tomorrow, and a new clamav-data to unstable as soon as a new database
 version appears.
 
 clamav-data in volatile is already running on the new clamav-getfiles,
 so the issue is already solved for volatile.
 
 I'm reassigning this bug to clamav-getfiles so that it automatically
 closes with the clamav-getfiles upload.

Excellent. Thanks for the fixed uploads.

 Greetings
 Marc

Regards,

Bas

- --
GnuPG: 0x77A975AD

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDnKN/RWRRA3epda0RAvfrAJ9cBT8JPJmeHsT9wYoaXWcxX/QbEQCdGDYP
xqraP4OYbLfz5210tzl5B/Q=
=96OK
-END PGP SIGNATURE-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#342644: restart fails in clamav-data.postinst

2005-12-10 Thread Marc Haber
tags #342644 confirmed
thanks

On Fri, Dec 09, 2005 at 09:14:10AM +0100, Bas Couwenberg wrote:
 While upgrading clamav-data from volatile today, I got the error that
 clamav-daemons database could not be reloaded.
 
 This is due to the fact that reload-database is not an action in the
 clamav-daemon init script.

This only applies to sarge; the clamav-daemon packages in sind and
etch have the reload-database action.

 If you use restart it does work. 

...  but it will unnecessarily restart the clamav-daemon on etch and
sid.

Please try the attached postinst which will catch sarge's
/etc/init.d/clamav-daemon's error message and then invoke the
initscript again with the restart target.

A different approach would be to signal the clamav-daemon manually,
but that would mean replicating a good part of clamav-daemon's init
script in clamav-data's postinst, and we would be using an
undocumented internal interface.

Greetings
Marc

-- 
-
Marc Haber | I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things.Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
#!/bin/bash
set -e

[ $CAD_DEBUG ]  set -x

INITSCRIPT=/etc/init.d/clamav-daemon

. /usr/share/debconf/confmodule

if [ $1 = configure ]; then
  db_get clamav-data/warn-on-old-databases
  db_stop
  rm -f /var/lib/clamav-data/warn-on-old-databases
  if [ $RET = true ]; then
touch /var/lib/clamav-data/warn-on-old-databases
  fi
  if [ -x $INITSCRIPT ]; then
RET=0
OUTPUT=$($INITSCRIPT reload-database 21) || RET=$?
if echo $OUTPUT | grep -q ^Usage: /etc/init.d/clamav-daemon 
{start|stop|restart|force-reload}; then
  # we have an old clamav that doesn't support reload-database
  RET=0
  $INITSCRIPT restart || RET=$?
else
  echo 2 $OUTPUT
fi
# clamav-daemon init script will return 0 on no error and
# 3 on daemon is not running.
if [ $RET -ne 0 ]  [ $RET -ne 3 ]; then
  echo 2 WARN: signaling clamav-daemon to reload database failed
fi
if [ $RET -eq 3 ]; then
  echo 2 WARN: clamav-daemon not running, according to init script
fi
  fi
fi




Bug#342644: restart fails in clamav-data.postinst

2005-12-10 Thread Sebastiaan Couwenberg
Marc Haber wrote:
This is due to the fact that reload-database is not an action in the
clamav-daemon init script.
 
 This only applies to sarge; the clamav-daemon packages in sind and
 etch have the reload-database action.

True, I only checked the local init script, which if not even the Sarge
version but the one from volatile.

If you use restart it does work. 
 
 ...  but it will unnecessarily restart the clamav-daemon on etch and
 sid.

True, I didn't really think of that.

 Please try the attached postinst which will catch sarge's
 /etc/init.d/clamav-daemon's error message and then invoke the
 initscript again with the restart target.

I've tested the postinst, but it does not work with the volatile
clamav-daemon init script.

The volatile version gives:
Usage: /etc/init.d/clamav-daemon
{start|stop|restart|force-reload|reload-log}

While the Sarge version gives:
Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload}

It should work with both versions of the init script when you use:
grep -q ^Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload

I've attached my working version with the above fix.

 A different approach would be to signal the clamav-daemon manually,
 but that would mean replicating a good part of clamav-daemon's init
 script in clamav-data's postinst, and we would be using an
 undocumented internal interface.
 
 Greetings
 Marc

I don't that is necessary, your aproach to only restart if the init
complains seems to work fine.

Regards,

Bas

-- 
GnuPG: 0x77A975AD
#!/bin/bash
set -e

[ $CAD_DEBUG ]  set -x

INITSCRIPT=/etc/init.d/clamav-daemon

. /usr/share/debconf/confmodule

if [ $1 = configure ]; then
  db_get clamav-data/warn-on-old-databases
  db_stop
  rm -f /var/lib/clamav-data/warn-on-old-databases
  if [ $RET = true ]; then
touch /var/lib/clamav-data/warn-on-old-databases
  fi
  if [ -x $INITSCRIPT ]; then
RET=0
OUTPUT=$($INITSCRIPT reload-database 21) || RET=$?
if echo $OUTPUT | grep -q ^Usage: /etc/init.d/clamav-daemon 
{start|stop|restart|force-reload; then
  # we have an old clamav that doesn't support reload-database
  RET=0
  $INITSCRIPT restart || RET=$?
else
  echo 2 $OUTPUT
fi
# clamav-daemon init script will return 0 on no error and
# 3 on daemon is not running.
if [ $RET -ne 0 ]  [ $RET -ne 3 ]; then
  echo 2 WARN: signaling clamav-daemon to reload database failed
fi
if [ $RET -eq 3 ]; then
  echo 2 WARN: clamav-daemon not running, according to init script
fi
  fi
fi




signature.asc
Description: OpenPGP digital signature


Bug#342644: restart fails in clamav-data.postinst

2005-12-09 Thread Bas Couwenberg
Package: clamav-data
Severity: important
Tags: patch


While upgrading clamav-data from volatile today, I got the error that
clamav-daemons database could not be reloaded.

This is due to the fact that reload-database is not an action in the
clamav-daemon init script.

If you use restart it does work. 

I've patched the clamav-data.postinst
to use restart instead of reload-database.


-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.31
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
--- clamav-data.postinst-orig   2005-12-09 09:43:27.939435696 +0100
+++ clamav-data.postinst2005-12-09 09:44:45.127701296 +0100
@@ -13,11 +13,11 @@
   fi
   if [ -x $INITSCRIPT ]; then
 RET=0
-$INITSCRIPT reload-database || RET=$?
+$INITSCRIPT restart || RET=$?
 # clamav-daemon init script will return 0 on no error and
 # 3 on daemon is not running.
 if [ $RET -ne 0 ]  [ $RET -ne 3 ]; then
-  echo 2 WARN: signaling clamav-daemon to reload database failed
+  echo 2 WARN: signaling clamav-daemon to restart failed
 fi
 if [ $RET -eq 3 ]; then
   echo 2 WARN: clamav-daemon not running, according to init script