procmail
[Top] [All Lists]

Re: reading message before rcfile

1999-01-29 10:09:29
"David W. Tamkin" <dattier(_at_)Mcs(_dot_)Net> writes:
[This is a procmail _use_ question, so I'm posting to the Procmail List
rather than following Philip's instructions to continue the original
thread on procmail-dev.]

Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net> had asked, regarding 
Sean Straw's use
of a global lockfile to minimize simultaneous swapping,

R> But... *exactly* *when* does procmail read in the message;
R> the first time it "needs" it (presumably after things like the above
R> at the start of .procmailrc), or right away (in which case the
R> message has already consumed the memory it needs by the time the
R> LOCKFILE is set?

Philip Guenther responded,

G> Procmail reads in the message before opening any rcfiles.  About the
G> only case which would be helped by delaying it would be this very
G> case:  an early assignment to LOCKFILE, before any recipes.

What if the global lockfile is assigned on procmail's command line?  Does
procmail then secure the lock before reading the message into memory?

No.  Procmail's operation runs something like this:

        Parse command line flags (-d, -p, -f, -m, etc)
        Clean up the environment
        Figure out whether the invoking user is 'trusted'
        Setup signals and file descriptors
        Handle the "From " line
        Read in the entire message
        If in the delivery mode, fork for each user (one at a time)
        Become the correct user
        Set ORGMAIL, HOME, DEFAULT; set the umask
        if not mailfilter mode, screen $ORGMAIL (check for links, permissions)
        Handle command line assignments; set up $1, $2, etc
        LOOP: {
                Open an rcfile
                LOOP: {
                    process a line
                } while there are lines
        } while there are rcfiles left.
        if we haven't delivered the message yet {
            save to $DEFAULT
            if that failed, save to $ORGMAIL
        }
        process TRAP
        if EXITCODE is set, exit with the specified value
        if we failed to deliver the message, exit with EX_CANTCREAT
        else exit with EXIT_SUCCESS
        

Philip Guenther

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