procmail
[Top] [All Lists]

Re: What am I doing wrong, (catching too much quoted text)

1999-07-07 23:51:53
I have directed this to the Procmail list for followups, as I don't
think this is particularly germane to the SmartList list anymore.

On Wed, 7 Jul 1999 17:06:21 -0700 (PDT), Dan Mick
<Dan(_dot_)Mick(_at_)West(_dot_)Sun(_dot_)COM> wrote:
I recommended
:0A
| cat >/tmp/saved.quote.reject
era changed it to
:0c
/tmp/saved.quote.reject.$$
I understand the explanation:
<...>
but am unclear on why you changed A to c...in fact, it's not
immediately clear to me what the utility of c vs. A is, even after
reading your FAQ. Comments?

Um, it was something I did rather unconsciously, sorry. But if you are
going to be doing anything with the saved file, you are probably going
to be needing that clone. So I didn't mean c +instead+ of A, I meant c
+in addition+ to A. (I was going to write something about how I prefer
braces over A/a/E/e for if/then/else constructs, too, but I guess I
forgot. Sorry about that, too.)

I'm not sure I'm not stating the obvious here, but the A/a/E/e flags
in no way override the default behavior when a message is delivered;
if it's delivered and there is no cloning or filtering, we're done:

 $ cat <<'HERE' >flagtest.rc
SHELL=/bin/sh     # always always always
DEFAULT=/dev/null # for this test
VERBOSE="yes please"
:0c
/dev/null         # always true, so :A will trigger
:0A
saved.quote.reject.$$
:0i  # now attempt to do something with the saved message
| rm -f saved.quote.reject.$$
HERE

 $ echo moo | procmail -m ./flagtest.rc
 procmail: [25282] Thu Jul  8 09:35:09 1999
 procmail: Assigning "LASTFOLDER=/dev/null"
 procmail: Opening "/dev/null"
 procmail: Assigning "LASTFOLDER=saved.quote.reject.25282"
 procmail: Opening "saved.quote.reject.25282"
 procmail: Acquiring kernel-lock
   Folder: saved.quote.reject.25282                                           5

See? The rm(1) never happens, because the message is delivered and
that's it, as far as Procmail is concerned. (I don't think the
documents are too clear about this. I was for a long time under the
impression that A somehow implied something like c, too.)

Now change the A to Ac:

 $ ed <<HERE flagtest.rc
/:0A
s??:0Ac
w
HERE
 266
 :0A
 :0Ac
 267

Now the rm gets a chance to happen:

 $ echo moo | procmail -m ./flagtest.rc
 procmail: [25298] Thu Jul  8 09:36:18 1999
 procmail: Assigning "LASTFOLDER=/dev/null"
 procmail: Opening "/dev/null"
 procmail: Assigning "LASTFOLDER=saved.quote.reject.25298"
 procmail: Opening "saved.quote.reject.25298"
 procmail: Acquiring kernel-lock
 procmail: Assigning "LASTFOLDER=rm -f saved.quote.reject.25298"
   Folder: rm -f saved.quote.reject.25298                                     5
 procmail: Executing "rm,-f,saved.quote.reject.25298"

... But perhaps you are using an external cron job or something to
eventually pick up the rejected messages?

you want to look at <http://www.iki.fi/era/procmail/quickref.html> as
an alternative to the "real" documentation.
Thanks; that's extremely useful, and I hadn't yet run across it.
There really needs to be an "official" clearinghouse for all these
nuggets somewhere...

That particular one is linked from www.procmail.org but there should
probably be more SmartList stuff there. I've done some searches but so
far run across precious little other than the mailing list archive,
Jason Kohles' FAQ, and Alan Stebbens' utility package (which of course
is not on the web as far as I know, but perhaps that can change :-)

/* era */

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

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