procmail
[Top] [All Lists]

Re: Do I need the 'w' flag?

1997-04-27 00:23:00
bodysurf(_at_)netcom(_dot_)com (Tim) writes:
On the below recipe, should I have a 'w' flag in there?  The reason I am
asking is that I've been experiencing some intermittent false negatives
(i.e., people on the friends' list slipping by this filter sometimes and 
other times they pass thru).  I can post extended diagnostic information
if the answer isn't an obvious "Yes".

Thanks.

      FROM=`$FORMAIL -rt -x'To:'`

      #
      # Check to see if this email is from a "friend".  If so, stick it
      # in my INBOX.
      #
      :0:
      * $FROM ?? ? grep -F -i -f $HOME/friends
      $ORGMAIL

Well, this shouldn't be causing the problem you're seeing, but it's a
'non-optimality' (that probably isn't a word): the initial dollarsign
on the condition is not needed.  Remember: "$FROM" is *not* the _name_
of the variable, it's the _value_ of the variable.  The name is just
"FROM".  In the procmail condition special "var ??", procmail wants the
_name_ of variable to match against (or feed into the command).  In
fact, procmail is parsing that condition line as follows:

        See '*': it's a condition.
        See '$': do variable expansion on rest of the recipe
        See 'FROM ??': get a pointer to the value of the 'FROM' variable
        See '?': examine the rest of the line for 'shellmetas'.  Since
                none are seen, do variable expansion ourselves (again),
                break on whitespace and execv it, feeding into it from
                the pointer obtained above.  Check the return code for
                success or failure.

Hmm, if your home directory path contains a '$' or a '`' (hurl), then
the double expansion would cause problems, but otherwise it should
really be causing problems, just a slight bit of inefficiency and the
continuation of a misconception.

Philip Guenther

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