Re: inconsistent recipie failure

[email protected] (Professional Software Engineering)
Newsgroups gmane.mail.procmail
Organization Professional Software Engineering
Message-ID <[email protected]>
At 07:42 2011-01-24, Robert Bonomi wrote:
>Yeah, well.  My .procmailrc is close to a thousand lines long, with *LOTS*
>of variable usage.  I wasn't going to inflict _that_ on the list. <grn>

The web is a wonderous thing.  However, my point was that when 
tracking down problems, "relevant" isn't always.

> > >     * $ ^Received: from [^ ]* \( *[^[].*${MAILHOST}
> > >     DELIVERABLE=|/bin/echo /home/bonomi/{{filename}}
> >
> > Would you mind explaining what you THINK this is accomplishing?
>
>I -know- exactly what it's doing.  and it does the job just fine.  <grin>

Actually, I wasn't asking about the condition, but rather the 
action.  The point here being that you admitted to not knowing why 
things were failing, perhaps elaborating on what you're trying to 
accomplish would help clarify why is is so broken.

>The action sets a variable specifying where the message should be filed.

:0
* condition
{
         # this syntax doesn't attempt delivery of the message, and
         # thus doesn't run into issues with early pipe closures, etc.
         # note braces and the absence of a pipe in the assignment.
         VARIABLE=value
}

What you're doing isn't simply trying to set a variable - you're 
taking the message and piping it to a program which does not even read stdin.

>I thought of that, but it just covers up the problem, rather than fixing
>it.

And the fix is in knowing that you're only trying to assign a fixed 
string value to a variable, and you should be doing that in a 
different fashion (as above).

>Given the way I'm doing things,
>
>   "echo {foo}; cat >/dev/null"
>
>should do the trick.

No.

> > And/or rethink how you're setting your variable.  Why are you using echo?
>
>"As opposed to?"  <grin>

I'm going to go with "the right way," or at least "some way that isn't broken."

>The only other way I know of to do it is along the lines of:
>
>     : 0
>     * <<condition>>
>     {
>       VARIABLE=value
>     }

If you were aware of this syntax, why aren't you using it?

I would suggest that everywhere in your recipes - including the 
"irrelevant" portions - you should carefully update your use of the 
pipe-to-echo for setting variables.

An added benefit to working correctly is that your procmailrc will be 
much more efficient, as a simple variable assignment should not 
involve spawning another process, and the overheads which that entails.

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.