procmail
[Top] [All Lists]

Re: Procmail handling of spawn_process exit code

2000-02-29 06:16:08

Philip Guenther writes:
....

You need to set procmail's exitcode by setting the EXITCODE variable in
the rcfile.  Setting it in the child doesn't help as the child's
environment is separate from the parent's.  Since the last child
process's exit code is in $?, you can just put the assignment

     EXITCODE = $?

after the action in the above.

......
The condition on nesting recipe is 'odd': The trailing ".*" does
nothing to the regexp because you're not capturing the matched text.
As a result, that recipe will _always_ match, because _every_ message
has a "From " header when procmail is invoked with the -d flag (as it
is being done as sendmail's local mailer).

So, what were you trying to do there?


Philip Guenther


Philip,
        thanks for your sharp and clean remarks on the topic
but perhaps I still miss a piece of knowledge here on 'c' flag.

I try to clarify what I would like to perform:

1 - all incoming messages delivered to the standard mailbox
    ( e.g. /var/spool/mail/$LOGNAME ) 
2 - messages that have the special application tag X-Application-Tag
    both delivered to standard mailbox and passed to the filter
    program granting that the program filter exit code be passed
    back by procmail to sendmail

This recipe ( could be  the actual one ) seems to work fine ...

:0
* ^From.*
* ^X-Application-Tag:.*
{
        :0 wr
        | $TEST
EXITCODE = $?
}

but when the 'filter' returns EX_OK the message in not delivered
to the standard mailbox.

So the way I' ve found to accomplish the aforementioned task 
is  this recipe:

:0
* ^From.*
* ^X-Application-Tag:.*
{
        :0 cwr
        | $TEST
EXITCODE = $?
}
 
Is that in your opinion a 'safe' recipe to do this task ?

Thanks a lot 

federico 

____________________________________________________________________________
        
Federico Tesei           
Finsiel S.p.A. 
Divisione Tlc 
Via Matteucci, 34/b      
56124 Pisa - Italy               

phone:   +39-(0)50-968-1 (operator) 968-616 (direct)
email: tesei(_at_)tecsiel(_dot_)it 
____________________________________________________________________________

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