procmail
[Top] [All Lists]

Re: Summary: Conflict between c flag and filter

2002-08-28 15:03:06
When there is a c flag, plus a set of braces, procmail forks: the first
handling the braces, and the cloan handling what is after the braces.
Never do that, unless you really intend to.

On Wed, 28 Aug 2002, Don Hammond wrote:

On 28 Aug, David W. Tamkin wrote:
| Udi wrote,
|
||         :0 c
||         *  2^0 $ ! ? $ANTIVIRUS $FILE
||         * -1^0 $ NOTHING ?? ? /bin/rm $FILE
||         {
||                 :0 Hh
||                 $HEADER
||         }
|
| Shouldn't that be just
|
|  :0hc # no local lockfile for $HEADER?
|  * 2^0 ! ? $ANTIVIRUS $FILE
|  * -1^0 NOTHING ?? ? rm $FILE # /bin isn't in $PATH?
|  $HEADER

Yes I agree. Udi might have done that to fix my example, which saved
the entire message instead of just the headers. Simply adding the "h"
flag is a much better fix for my oversight.

| Cloning procmail is a lot of overhead for no gain there.

Now I'm lost.  The "c" flag is there because Udi saves the message to
another file further down.  He wants a copy of the headers saved only
if f-prot indicates a virus (non-zero exit status). The idea was to
have one recipe, instead of the original spaghetti (sorry Udi ;-), which
only generates the clone when needed. You're not referring to the braces
as cloning procmail, are you?

| It also seems to me that, since 2-1 is just as positive as 2^N - 1, the 
first
| condition could be
|
|  * 0^2 ? $ANTIVIRUS $FILE
|
| but I suppose that the inversion really costs nothing (though the
| exponentiation might if the exit status of f-prot is greater than 1).
|

That's pretty neat. I learned something today. I have to confess that I
was all ready to dispute you on this, even having run tests to support
it. Then that little voice said, "wait a minute... if it's you or David
who's in error, who is it most likely to be?"

So I went back to the man page. ;-)

I then realized the tests had NOT been run with a "? program" condition,
so they were wrong. Imagine my relief at having paused when:

:0
* 0^2 ? false
{ }

did in fact produce:

procmail: Executing "false"
procmail: Program failure (1) of "false"
procmail: Score:       2       2 "false"

For those still scratching their heads, man procmailsc and search for
"Weighted program conditions".  I know there's some of these scored
inverted program conditions buried in my rcfiles.

Thanks David!



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