procmail
[Top] [All Lists]

Re: More "missing first F" problems

2002-10-25 08:20:15
On Fri, 25 Oct 2002, Robert Nicholson wrote:

a    Has the same meaning as the `A' flag, with the  addi-
             tional   condition  that  the  immediately  preceding
             recipe must have been successfully  completed  before
             this recipe is executed.

what does "successfully completed" mean with respect to a filter?

Exited with zero status.

I previously had this

:0 Wf:$HOME/filtmail.lock
| $HOME/.filtmail/filtmail

:0 a:$HOME/copy.lock
$MAILDIR/copy

and if filtmail exits with a zero exit status mail would go into copy
otherwise pass through to $DEFAULT

but now I have to add

:0hf
* ^^rom( )
| sed '1s/^rom/From/'

this before it hits copy so my rule ordering changes and therefore so 
does the "a" flag on the copy rule.

Do it like this:

--------------------------
:0 Wf:$HOME/filtmail.lock
| $HOME/.filtmail/filtmail

:0 a
{
 :0hf
 * ^^rom( )
 | sed '1s/^/F/'

 :0:
 $MAILDIR/copy
}
--------------------------

Or like this:

--------------------------
:0 Wf:$HOME/filtmail.lock
| $HOME/.filtmail/filtmail

:0 a:$MAILDIR/copy$LOCKEXT
| sed '1s/^rom/From/' >> $MAILDIR/copy
--------------------------

On Fri, 25 Oct 2002, Robert Nicholson wrote:

Is that Philip says still the case?

http://MailMan.RWTH-Aachen.DE/pipermail/procmail/2002-March/008774.html

It's become pretty clear that this IS in fact a bug in procmail.  It only
happens to have the same symptoms as a locking race condition.

On Fri, 25 Oct 2002, Robert Nicholson wrote:

# Work around procmail bug: any output on stderr will cause the "F" in 
# "From" to be dropped.  This will re-add it.

Does anybody know if procmail outputs to stderr if a filter returns a 
non zero exit status?

The bug is believed to occur when the FILTER produces output to stderr,
not if procmail produces output.  However, this has never been definitely
established.

So you could try:

:0 Wf:$HOME/filtmail.lock
| $HOME/.filtmail/filtmail 2>/dev/null

Is that the "Recovered from filter failure..." message or some such?

Recovery from filter failure may very well be related to this bug, but it
sometimes occurs even when the filter succeeds.

My latest test shows that if my filter ie. perl script returns a 0 exit
status the message will go through fine. If however, it travels down the
logic path that returns a 1 exit status then it will always chop off the
leading "F"

I that case you could use:

--------------------------
:0 Wf:$HOME/filtmail.lock
| $HOME/.filtmail/filtmail

:0 a:
$MAILDIR/copy

:0 ehf
* ^^rom( )
| sed '1s/^/F/'
--------------------------

I'm wondering if procmail writes to stderr when a filter exists with a 
non zero exit status.

It does, but that's not relevant as far as anyone knows, because with
VERBOSE=yes it also writes to stderr on filter success, apparently without
tripping the bug.


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