procmail
[Top] [All Lists]

Re: procmail: Error while writing to "/_Hg3Ggsdws133"

1996-11-06 17:55:49
David Worenklein <dcw(_at_)gcm(_dot_)com> writes:
Here's my .procmailrc

      ##########################################################
      # Let's start filtering out "from"s - I wonder if I have #
      # to go from a black list to a white list! :-(           #
      ##########################################################
      :0 c
      {
      VERBOSE=yes
      :0
      * ? /home/dcw/bin/checklist.pl "$SENDER" $MAILDIR/whitelist

      :0 E:/home/dcw/FILTER.LOCK
      * !^(Original-)?(Resent-)?(From|Sender):.*(root|postmaster|abuse)
      | (cat $MAILDIR/fromlist;  echo $SENDER) > /tmp/list; sort -u < /tmp/li
st > $MAILDIR/fromlist
      VERBOSE=no
      }

The first of the nested recipes needs to have an action.  You also need
the 'i' flag on the second recipe.  The following would work, though see
below:

:0 c
{
    :0
    * ? /home/dcw/bin/checklist.pl "$SENDER" $MAILDIR/whitelist
    { }

    :0 Ei:/home/dcw/FILTER.LOCK
    * ! ^(Original-)?(Resent-)?(From|Sender):.*(root|postmaster|abuse)
    | (cat $MAILDIR/fromlist;  echo $SENDER) | sort -u -o $MAILDIR/fromlist
}

If you tell sort where to put it's output via the -o flag, then it's won't
open it until the sorting is done (which implies all the input being read).
Saves a temp file.  BTW: if checklist.pl uses $MAILDIR/fromlist, then you
should put the same locallockfile on the first nested recipe as the second
to keep checklist.pl from reading a truncated version of fromlist.


...
PS Is there an easier way to say "if such-and-such program doesn't
return a value"? I tried !? and ?! but neither one seemed to work.


The former of those should work, though you may need to separate them
with whitespace.  I'm using procmail 3.11pre4 and the following worked:

:0
* ! ? false
foo

delivering all my mail to "foo".

(Actually, if your $SHELL is posix.2 compliant, then "? ! false" would
also work, as posix.2 added a '!' builtin to the shell that negates the
return code of the following command, but since that's much less portable
than using procmail's builtin negation, don't do it!)

Philip Guenther

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