procmail
[Top] [All Lists]

Re: Including a shared recipe in .procmailrc

1996-10-26 18:00:32
Philip Guenther included this in his enlargement on my advice to Catherine
Hampton:

| LOG = "*** WARNING: whatever includerc this is was invoked without setting
| FILENAME first.  All the recipes are therefore being skipped.  That INCLUDERC
| line is doing nothing in your .procmailrc.
| "

Point 1: You can get the name of the current rcfile, whether main or
included, in the $_ variable.  (That is, as long as there are no characters
from $SHELLMETAS in the way.  If there are, you may need to set

 RCFILE=$_

first and then refer to $RCFILE.  Be careful, because if the last assignment
to $RCFILE was done in a different rcfile, it will show its old value.)

Point 2: I wouldn't say that the INCLUDERC line is doing nothing.  Perhaps
it sometimes accomplishes something but just didn't for this particular
message.

So I'd say, using his same example where the critical variable is named
FILENAME,

  LOG = "*** WARNING: procmail rcfile $_
was invoked without setting FILENAME first.  All recipes in it have
therefore been skipped.
"

[It would be nice if there were a way other than enclosing the rest of the
 rcfile in the braces of an else clause to make procmail skip the rest of
 the included rcfile and return from it early.]

Philip's advice is, of course, unassailable: make those shared rcfiles as
bulletproof as possible and make sure that they change back any important
variables like $MAILDIR, $PATH, $DEFAULT, $ORGMAIL, $SHELL, $SHELLFLAGS, and
$SHELLMETAS (if there is a reason to change them in the first place).

| The idea to program defensively.

Amen.

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