procmail
[Top] [All Lists]

Re: INCLUDERC

2004-03-12 16:09:13
On Fri, Mar 12, 2004 at 10:57:44PM +0100, Robert Allerstorfer wrote:

On Fri, 12 Mar 2004, 16:27 GMT-05 Don Newcomer wrote:

I'm using Procmail 3.22 under Tru64 UNIX version 5.1B.  I'd like to
have an INCLUDERC entry in my global procmail file but have it only
happen if the target file actually exists.  

 TEST = /usr/bin/test
 # be sure to specify the correct path

 my_INCLUDEFILE = /path/to_my/includefile.rc

 :0
  * $ ?"$TEST -r $my_INCLUDEFILE"
  { INCLUDERC $my_INCLUDEFILE }

That's not bad.  Here's a way to approach this that doesn't fork a
shell.

You could temporarily change the logfile.  You won't see an error
message in your logs, but you will see the assignment statement.


  OLDLOG = $LOGFILE
  LOGFILE  # unset

  INCLUDERC = /path/to/includefile.rc

  LOGFILE = $OLDLOG


In the log then appears:

  procmail: Assigning "LOGFILE"



Btw, regarding using the "$" expansor in the condition line as
Robert has done, okay, no real harm done; but since he already
set $my_INCLUDEFILE in an assignment statement that didn't use
surround-quotes, one can presume that there is no whitespace or other
oddness in the path/filename.  (Otherwise, he'd have needed to use
quotes in the assignment.)  Since we explicitly set the path and know
that it will parse without quotes, it seems needless then to use the
"$" token and surround-quotes in the condition line.  Unless you have
whitespace in your paths to the file or to test (which I seriously
doubt), this would be fine:

  * ? $TEST -r $my_INCLUDERFILE

Moreover, while I read the exchange Robert had about test and understand
his reasons for setting the var, most installs of procmail under most
people's setups shouldn't require it.  After all, procmail wishes to use
the shell's own test module if it has one, before it calls a physical
file such as /bin/test (if it must).  And only under an odd confluence
of circumstances such as Robert found exist on his machine with his
present procmail compile, would that be a bad thing.

I can't remember the exact thing that was behaving oddly with Robert's
test invocation before he explicitly defined it; but I suspect, even
with that weirdness, that the test he has by default under his procmail
would be able to identify whether a certain file exists and is readable.

Anyway, that's just a picayune assertion of mine that, presuming it went
over somebody's head, can just be ignored.  It's not important. :-)

-- 
dman

_______________________________________________
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>