Subject: Re: /bin/sh "Cannot vfork" behaviour
To: None <>
From: Alan Barrett <>
List: tech-userlevel
Date: 10/29/2003 00:16:28
On Tue, 28 Oct 2003, David Laight wrote:
> I suspect the 'exit' is the traditional behaviour for fork failing in a
> non-interactive shell.
> A traditional bourne shell (and pdksh) will sleep and retry the fork,
> NetBSD's /bin/sh doesn't.

I don't mind whether or not it sleeps and retries, but I *really*
do not want to lose mail when a command that's invoked from
my .forward file encounters a temporary error.  For example,
consider the following .forward file:

	"| test \! -e /some/file && /usr/pkg/bin/procmail -flags || exit 75"

If sendmail itself cannot fork, then it keeps the mail in its queue and
retries later.  If the "test" fails, then the "exit 75" happens, and
sendmail defers the mail.  If procmail cannot fork, it does something
sane and tries very hard not to lose mail.  If the shell cannot fork,
well, I feel that I have asked it to exit with status 75 (EX_TEMPFAIL
from <sysexits.h>.  If the shell disobeys my intent and exits with
status 2, then sendmail bounces the mail.

I am working around the problem using the "es=75; trap 'exit $es' 0"
technique mentioned in my previous message, but I wish I didn't have to.

--apb (Alan Barrett)