Let's revisit Mark's question, because I'm going to give an answer that
overlaps somewhat with Martin's but is somewhat different.
| I have a simple test example that should return the standard out of
| a program into SCR but doesn't. I have no idea why. In the PERL script
| I even have it sending to both STDOUT and STDERR to no avail. Here is the
| .procmailrc snippet:
|
| SHELL=/bin/sh
| LOGABSTRACT=all
|
| :0 Wi
| SCR=| /u/bynum/spam/rbl-check3.pl -all
|
| :0:
| * SCR ?? .
| spamtest
| procmail: Executing "/u/bynum/spam/rbl-check3.pl,-all"
| procmail: Assigning "SCR="
| -osirusoft returns 127.0.0.2 for 198.5.241.40, mail is probably spam.
| procmail: Non-zero exitcode (25) from "/u/bynum/spam/rbl-check3.pl"
| procmail: No match on "."
| As you see the program does generate output (look at the -osirusoft line)
| but the variable never gets set. (Remember the same output goes to STDOUT
| in addition to STDERR)
Are you positive that the output goes to both? I see the result of stderr
in your log but it's not so easy to tell what stdout is. When you run it
from a shell prompt, do you see the output twice on the terminal?
I think the first thing we need to do is to see what really is in stdout.
Try this:
:0 Wi
SCR=| /u/bynum/spam/rbl-check3.pl -all
LOG="The value if \$SCR is $SCR
"
:0:
* SCR ?? .
spamtest
and we'll know for sure. Maybe the output is getting only to stderr and
nowhere else.
The next thing is like Martin's answer: perhaps the W, by its nature of
meaning "wait for the exit code of the program and put things back as they
were if it is non-zero" is preventing procmail from assigning SCR when the
exit code is not zero. I don't like the man page's description of "wait for
the program to finish" because when the program is a filter or its stdout is
captured in a variable, of *course* procmail has to wait for the program to
finish, with or without `w' or `W' on the flag line. What happens if you
drop the `W'?
| The program is supposed to return non-zero in
| case of a match, like above.
Do you really need to test on the output, then, or is testing on the exit
code enough? If the exit code is non-zero for mail that belongs in the
spamtest folder and zero for mail that doesn't,
:0:
* ! ? /u/bynum/spam/rbl-check3.pl -all
spamtest
If /u/bynum is your home directory, I'd recommend invoking the perl script
as $HOME/spam/rbl-check3.pl in case the system is reorganized and your home
directory is relocated. Even if you're the sysadmin and the reorganization
wouldn't come as a surprise to you, by referencing $HOME instead of the
absolute path you won't have to edit your .procmailrc if you move your home
directory.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail