Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 70960

Summary: clamav startup doesn't handle LocalSocket changes
Product: Gentoo Linux Reporter: Phil Pennock <gentoo>
Component: [OLD] ServerAssignee: Net-Mail Packages <net-mail+disabled>
Status: RESOLVED FIXED    
Severity: enhancement CC: antivirus, rockoo
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Phil Pennock 2004-11-12 06:15:02 UTC
The default value of LocalSocket is a location in /tmp/, which is subject to race-conditions for restarts (between the init.d script removing it and the server starting, something else might create it, keeping the server from starting successfully).  I'm not arguing with the default being what it is, but wish to be able to change the location without having to modify the init.d script after every emerge of clamav.  It's possible to move LocalSocket to another location, provided that the 'clamav' usercode can create the socket there.  One solution is to make it the user's responsibility to update a variable in /etc/conf.d/clamd to match the value in /etc/clamav.conf.

So I changed the start of the start() function in /etc/init.d/clamav; this changed version should handle the default case well, whilst allowing the user to change the location.  Could this please go into the next .ebuild?

start() {
        if [ "${START_CLAMD}" = "yes" ]; then
                if [ -S "${CLAMD_SOCKET:-/tmp/clamd}" ]; then
                        rm -f "${CLAMD_SOCKET:-/tmp/clamd}"
                fi
                sockparent="$(dirname "${CLAMD_SOCKET:-/tmp/clamd}")"
                if [ ! -d "$sockparent" ]; then
                        mkdir -p "$sockparent"
                        chown clamav:clamav "$sockparent"
                fi


Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Andrej Kacian (RETIRED) gentoo-dev 2005-05-14 14:38:35 UTC
Actually, I've decided that Gentoo's default location for clamd socket will be in /var/run/clamav/ instead of /tmp/. The initscript will fetch the LocalSocket value from clamd.conf file.

/var/run/clamav will also contain clamd.pid and freshclam.pid, and will be owned by clamav:clamav, thus the sockparent part of your suggested change will not be needed.

Thanks for your suggestion, and look out for clamav-0.85-r1 :)