procmail
[Top] [All Lists]

Re: Procmail forking question

1995-10-21 10:50:01
Mike Sprague had a cloning problem:

| Now when procmail goes to fork itself, ...

(as many of us have frequently told it to)

| ... it seems to use the wrong path name for the rcfile and gives the "Lost
| x" error.  Here x is /usr/local/mail/smartlist/./rc.submit.  I noticed that
| when flist starts the rc.submit rcfile, it does it with a relative path of
| ./rc.submit.  So for some reason, the fork attempts to use the full path to
| the smartlist user's home directory, then the ./rc.submit, so it fails.

You're right on the money about what's going wrong; if procmail is started
with the -m option (as flist starts it), all relative paths to rcfiles are
interpreted from the current directory; if $MAILDIR has been changed, the cwd
has changed, because procmail always chdirs to $MAILDIR.  That's why rcfiles
that clone procmail need to be specified on the command line with absolute
paths (or without -m, in which case they are considered relative to the uid's
$HOME, which doesn't get changed when $MAILDIR is changed).

I wonder why others haven't complained about this.  Did you add, remove, or
alter a MAILDIR assignment somewhere in SmartList's rcfiles?

| My question, is there any way to give arguments to the forking procmail
| when the f flag is used?

It's the `c' flag, not `f', that causes the trouble.

| If I should direct this to the smartlist mailing list instead, please let
| me know.

It's a problem with procmail's cloning feature, so perhaps it belongs on the
Procmail List or on both lists.

| Or does flist have to hacked to use full paths instead of relative paths?

I hope not!  I had a couple ideas concerning an INCLUDERC directive and a
pipe to another procmail, but neither would have worked.  (Well, the pipe to
another procmail would have worked if we could guarantee that there would be
no error from the forwarding instruction and that thus the clone should never
get past the right brace.)

Here's my only other suggestion.  My changes are commented:

    # Assign these before procmail can be cloned:
    olddir=$MAILDIR
    MAILDIR=/path/to/directory/that/contains/rc.submit

    :0 A c
    * ? test -f $olddir/accept.txt # accept.txt's location is now $olddir
    {

      :0 fh
      | formail -i"From: $listreq" -kbrtA"X-Loop: $listaddr" ; \
        cat $olddir/accept.txt # as above

      :0
      ! $sendmailOPT -t
    }

    MAILDIR=$olddir # to set it back in case no clone was forked
                    # or in case handoff to $SENDMAIL failed

Mike's quote from the rcfile had two more right braces at this point;
they must be for closing blocks that start earlier.

<Prev in Thread] Current Thread [Next in Thread>