Bug 668131 - clamd-wrapper reload() function broken due to incompatible sigspec
Summary: clamd-wrapper reload() function broken due to incompatible sigspec
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: clamav
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
high
Target Milestone: ---
Assignee: Enrico Scholz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-08 03:04 UTC by James Ralston
Modified: 2012-01-08 11:49 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-01-08 11:49:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
use -HUP/-USR2 instead of -SIGHUP/-SIGUSR2 to make bash happy (492 bytes, patch)
2011-01-08 03:05 UTC, James Ralston
no flags Details | Diff

Description James Ralston 2011-01-08 03:04:11 UTC
The clamd-wrapper script (not part of upstream) contains the follow commands in the reload() function:

killproc -p ${CLAMD_PIDFILE} $procname -SIGHUP  || rc=$?
killproc -p ${CLAMD_PIDFILE} $procname -SIGUSR2 || rc=$?

However, these commands will always fail, because clamd-wrapper (properly) uses /bin/sh (instead of /bin/bash) for the shebang line, and when bash is invoked as /bin/sh instead of /bin/bash, for at least x86_64, the built-in kill() function does not support the SIG prefix for signal names:

$ ( /bin/bash -c 'kill -HUP $$' )
Hangup

$ ( /bin/sh -c 'kill -HUP $$' )
Hangup

$ ( /bin/bash -c 'kill -SIGHUP $$' )
Hangup

$ ( /bin/sh -c 'kill -SIGHUP $$' )
/bin/sh: line 0: kill: SIGHUP: invalid signal specification

Because the reload() function always fails, /usr/sbin/clamav-notify-servers always silently fails.

Arguably, this is a bug in bash... but traditionally, the "kill" program hasn't used the "SIG" prefix for signal names. (Perhaps there is a standard somewhere that defines this?)

At any rate, regardless of whether the behavior of bash is changed, for maximum portability (and more importantly, to avoid breakage), clamd-wrapper should not use the "SIG" prefix.

(I'm filing this bug against rawhide, but it affects all Fedora/EPEL releases.)

Comment 1 James Ralston 2011-01-08 03:05:02 UTC
Created attachment 472333 [details]
use -HUP/-USR2 instead of -SIGHUP/-SIGUSR2 to make bash happy

Comment 2 James Ralston 2011-01-19 20:22:57 UTC
Enrico, any idea when you'll have a chance to fix this? The patch is very simple...

Comment 3 Enrico Scholz 2012-01-08 11:49:45 UTC
thx; was fixed some time ago by 77795d29eba0129ae8d163170d54f57d44c7cbed (2011-01-08).


Note You need to log in before you can comment on or make changes to this bug.