procmail
[Top] [All Lists]

Re: Using personal .procmailrc over global .procmailrc

2002-02-14 09:33:05
Not a great day for you, Michael.  You went 0 for 4 in that post.

You didn't understand the point of my suggestion:

| David W. Tamkin wrote:
|
| > In /etc/procmailrc,
| >
| >  :0
| >  * ? test -f $HOME/.procmailrc
| >  {
| >    DROPPRIVS=yes
| >    SWITCHRC=$HOME/.procmailrc
| >   }

on which Philip has since improved:

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

You reacted,

| Thing is, if you use the !, you don't have to include the above two lines
| in the recipe, and you can just have the default behavior be the "Right
| Thing", which ... appeals to me more.
|
| :0
| * ! ? [ -f $HOME/.procmailrc ]
| {
| # stuff to do if there is NOT a $HOME/.procmailrc
| }

So instead of including those two lines (or one line, per Philip's
improvement) between that recipe's braces, you get to include the entire
remainder of /etc/procmailrc in there instead, as Philip beat me to
explaining.  You then have to be careful ever after into the future not to
mess up the nesting when you edit; moreover, whenever a user *does* have a
.procmailrc, you're forcing procmail to scan and parse the rest of
/etc/procmailrc to find the matching right brace paired to that left brace
instead of letting it get out of there right there and then.  How can that
appeal to you at all, let alone more?

Philip has also explained -- and I would have if he hadn't already done
so -- why it's better to use the word "test" than brackets there.  I
actually like the brackets better and always use them in shell scripts and
functions, but in a procmail rcfile the word is preferable.  If there is
another reason that the command string needs a shell anyway, by all means
use brackets there if you like them, but be careful: if you edit the command
string some day and no longer have any other reason to make procmail invoke
a shell for it, you should change the left bracket to the word "test" and
get rid of the right bracket.

You then told us,

| BTW, "[" == "test".

... as if we didn't already know.  That was very rude.

| Of course, determining $HOME could get tricky, seeing as it isn't set up
| at that point, methinks. But ICBW.

There's no "could" about it this time.  $HOME and $LOGNAME are already
assigned at that point, and it's common to rely on them in /etc/procmailrc.



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