Subject: pkg/13458: Fetchmail 5.8.10 in pkgsrc is broken with mda procmail for some reason
To: None <gnats-bugs@gnats.netbsd.org>
From: None <sudog@sudog.com>
List: netbsd-bugs
Date: 07/13/2001 08:34:19
>Number:         13458
>Category:       pkg
>Synopsis:       with mda "/usr/pkg/bin/procmail -d blah" fetchmail gets incorrect return code
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 13 08:32:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Marc Tooley
>Release:        1.5.1
>Organization:
>Environment:
	PentIII/NetBSD/i386/bah
System: NetBSD draco.sudog.com 1.5.1 NetBSD 1.5.1 (draco) #1: Thu Jul 12 20:24:14 PDT 2001 root@draco.sudog.com:/usr/src/sys/arch/i386/compile/draco i386

>Description:
	Looks like fetchmail has been broken. Repeatable on two machines (but
	perhaps not on yours? :)) Fetchmail when configured to use:
		mda "/usr/pkg/bin/procmail -d user" fails and the pclose() on the mda
	returns an errno of ECHILD. Have no clue why--maybe because of the 
	sighandler? Anyway, it only collects the return code for cases of
	disk-full, that sort of thing so why bother to fail for ECHILD?
>How-To-Repeat:
	Install procmail. Follow suid suggestion for it.
	Install normal NetBSD-ized fetchmail. Configure fetchmail to use:
		defaults protocol POP3 fetchall mda "/usr/pkg/bin/procmail -d user"
		poll server.domain username user password password
	...for email delivery. Run it with "fetchmail -v -v". Notice how
	fetchmail chokes with "MDA returned non-zero blah blah" and leaves
	your email on the server. Now put fetchmail into the background with:
		fetchmail -d 300
	...and go to sleep. Wake up the next morning with hundreds of identical
	messages sitting in your inbox.
>Fix:
	The following will work fine but is a kludge. It should really be
	fixed properly. On the other hand, if it works fine, then why not?

--- fetchmail-5.8.10/sink.c	Sun Jun 24 16:41:40 2001
+++ fetchmail-5.8.10-fixed/sink.c	Fri Jul 13 08:15:07 2001
@@ -956,7 +956,7 @@
 	}
 	else
 	    rc = 0;
-	if (rc)
+	if (rc && errno != ECHILD)
 	{
 	    report(stderr, 
 		   _("MDA exited abnormally or returned nonzero status\n"));

>Release-Note:
>Audit-Trail:
>Unformatted: