procmail
[Top] [All Lists]

Re: Aloha! A question about STDERR...

2001-02-13 02:25:13
Michael J Wise <mjwise(_at_)kapu(_dot_)net> writes:
Philip Guenther wrote:

Even if procmail did that (which is doesn't), the redirection in the
command would override it.  If SHELLMETAS was misset or unset then you
would get a usage error message from nslookup.  Therefore, either
a) your /bin/sh is broken;

Unlikely. BSDI "SuperServer" 4.1

Yes, but follow my logic below...


b) the nslookup command being invoked sends error messages to stdout;

Doesn't do that when I invoke sh and feed it the same command.

When procmail is run to process incoming message, is it running on the
same host?  To answer that question is why I included "HOST = $HOST"
in the LOG assignment.

...
How about just `which nslookup`?

The "which" command is too smart for its own good: most versions are
csh scripts that source your .cshrc looking for aliases.


Anyway, let's apply some logic:

1) When performing command expansion (backquotes), STDOUT (fd 1) in the
   command is a pipe back to procmail.  That's how it gets the data for
   the command expansion.

2) Therefore, the only file descriptors open in the command process that
   point to the logfile are 2, and maybe other above 2 (though that would
   be a bug in procmail).

3) If the shell is properly executing the "2>/dev/null" redirection, then
   fd 2 would be opened to /dev/null.

3) Therefore, if a message is getting from nslookup to the logfile, then
   either
   a) procmail is leaving open fds above 2 that point to the logfile
      and nslookup sends its error message to that fd; or
   b) nslookup sends it error message to the value of the LOGFILE
      environment variable; or
   c) statement (1) is incorrect -- procmail is opening STDOUT = fd 1
      to the logfile -- and nslookup sends its error message to fd 1
   d) statement (2) is incorrect and your shell is broken


So, which of (a), (b), (c), and (d) do you think is the most likely?

What happens when you change the assignment to

        NSLOOKUP=`nslookup ${REVERSED}.correct.domain.here 2>nslookup.err`

1) does nslookup.err file get created?
2) does the error message still go to the logfile?
3) what shows up in nslookup.err?


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

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