Subject: pkg/37348: Clamav-0.91.2 in pkgsrc-2007Q3 appears to be broken out of the box.
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <buhrow@lothlorien.nfbcal.org>
List: pkgsrc-bugs
Date: 11/09/2007 08:00:00
>Number:         37348
>Category:       pkg
>Synopsis:       Clamav-milter fails after it starts up but before it begins scanning.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 09 08:00:00 +0000 2007
>Originator:     Brian Buhrow
>Release:        pkgsrc-2007Q3
>Organization:
	
>Environment:
	
	
System: NetBSD lothlorien.nfbcal.org 3.1_STABLE NetBSD 3.1_STABLE (RBL) #0: Sun Jun 24 09:39:33 PDT 2007 buhrow@lothlorien.nfbcal.org:/usr/src/sys/arch/i386/compile/RBL i386
Architecture: i386
Machine: i386
>Description:
	As part of its startup procedure, clamav-milter calls res_init().
This routine tries to write to stderr, which clamav-milter has previously
closed. It then dies with a EBADF error and a call to abort().  Unfortunately,
all this activity is masked by a total lack of error messages and the
program silently disappears from the ps list after it purports to be fully
initialized and ready for action.  I've tested this against
sendmail-8.14.1, which is the version in the pkgsrc-2007Q3 source tree, as
well as against the 8.13.3-5 versions available in the NetBSD-3 source
trees.
>How-To-Repeat:
	
	Build and install the clamav-0.91.2 package from the pkgsrc-2007Q3
branch of the pkgsrc collection.  Then run:
/usr/pkg/sbin/clamav-milter -o -l -q <name of milter socket>

>Fix:
	
	My hackish solution was to  modify
work/clamav-0.91.2/clamav-milter/clamav-milter.c
relative to the /usr/pkgsrc/mail/clamav directory
such that the following lines are commented out.

	/*if(!(_res.options&RES_INIT))
		if(res_init() < 0) {
			fprintf(stderr, "%s: Can't initialise the resolver\n",
				argv[0]);
			return EX_UNAVAILABLE;
		}*/

	Doing this makes things work.  I know this isn't a proper fix, but
this was the least invasive thing I could think to do at the time that
actually worked.  What's strange is that if I put print statements where
res_init should actually get called, they don't execute, making me thing
the first if statement doesn't test true.  However, commenting just these
lines out fixes the problem.  perhaps someone with more knowledge could
look at this and come up with a more correct fix.
	In any case, it seems like a serious problem, at least for those who
run clamav-milter on NetBSD based systems.
-thanks
-Brian

>Unformatted: