procmail
[Top] [All Lists]

Re: Using personal .procmailrc over global .procmailrc

2002-02-15 07:32:10
Louis-David Mitterrand misunderstood Philip Guenther's advice to Peter
White, which was,

:0
* ? test -f $HOME/.procmailrc
{
SWITCHRC = /dev/null
}

That also lets procmail perform security checks on the user's .procmailrc
to make sure it's owned by the correct user and has 'safe' permissions.


Louis-David objected,

| The procmailrc man pages says:
|
| SWITCHRC    Names  an  rcfile  (relative  to  the  current
|                    directory)   to   which   processing  will  be
|                    switched.  If the named rcfile  doesn't  exist
|                    or  is  not a normal file or /dev/null then an
|                    error will be logged and processing will  con­
|                    tinue  in the current rcfile.
|
| "processing will continue" if /dev/null, which is quite the opposite of
| your goal here.

No, processing will continue if it's neither a normal file nor /dev/null.

Louis-David, you seem to have read the second sentence of that excerpt as
"If the named rcfile doesn't exist or is (not a normal file) or (/dev/null)
then an error will be logged and processing will continue in the current
rcfile."  The proper parsing is, "If the named rcfile doesn't exist or is
not (a normal file or /dev/null) then an error will be logged and processing
will continue in the current rcfile."

It would be redundant to say what you read it as, because /dev/null is not a
normal file.

Here's a better way to say it, I think: "The rcfile named must be an
existing normal file or /dev/null; otherwise procmail will log an error and
continue processing the current rcfile."

| It should be "unset SWITCHRC" instead.

No, that won't accomplish the intended goal of exiting the current rcfile;
it will just remove the value of the SWITCHRC variable in case there's an
attempted reference to it with $SWITCHRC somewhere farther along in the same
rcfile.

SWITCHRC=/dev/null is a special assignment meaning "act as if this rcfile
ended here."  So in ~/.procmailrc that means "try delivering to $DEFAULT,
and if that fails, to $ORGMAIL."  In a file called with an INCLUDERC
assignment, that means to go back to the rcfile from which this one was
called.  In /etc/procmailrc it means drop privileges, check the sanity and
safety of ~/.procmailrc, and continue processing in ~/.procmailrc.

| Or did I miss something?

You missed that Philip is the maintainer of the procmail source code and
that he knows this stuff better than the rest of us totaled together.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail