procmail
[Top] [All Lists]

Re: message size into subject?

2008-03-01 04:46:05
On Fri, Feb 29, 2008 at 11:44:48PM -0600, David W. Tamkin wrote:

Dallman Ross wrote:

  :0 HB
  *  1 ^1 .
  *  1 ^1 ^.*$
  * -1 ^0
  { SIZE = $=

...

  }

Btw, the part near the top that finds the size is a very
old trick originally from, I believe, David W. Tamkin.

If Dallman's belief is correct, then I'm the one who owes everyone an
apology for it.  The way to get the size of a message into a variable is
this:

  :0
  * 1^1 > 1
  { SIZE = $= }

[some fun alternatives snipped]

Size conditions operate on the HB space regardless of colon-line flags,
so it's not necessary to specify HB on the colon line to get the body
included.  H ?? or B ?? on the condition line can override that, but
here we don't want to.

Okay, that's good to see again, and I obviously needed my knowledge
refreshed about it.  Thank you.  I would like to explain how I came
to attribute to you that goofy way (that nevertheless works fine).
There is a story behind it.

First a preface: I had previously seen all that stuff you wrote in
the message I'm replying to, and more than once, in fact; but not
recently.  I am almost certain I even saved very similar messages
in my own disorganized archive of "best-of" procmail tips that
goes back about 12 years.  But personally, I haven't had procmail
looking for the byte-count of a message in a very, very long time.
I usually see it in my Mail reader's abstract line when I'm reading
mail in the shell, so there's no need for me to.[1]

Okay, so as you may know, David, I was helping a user on our shell
provider, panix, with procmail issues last week in one of the local
newsgroups.  He published his .procmailrc.  It was pretty much a
mess.  But it did have this bit in it:

     # Get message size (recipe from David W. Tamkin)
     :0HB   # Note trailing period in first condition line
     * 1^1 .
     * 1^1 ^.*$
     * -1^0
     { }
     THESIZE = $=


Notice the comment at the top.

Personally, I thought that was a bit whack and vaguely recalled that
the "official" way was more elegant looking.  But I made the erroneous
assumption that I needn't bother to research further to refresh my
memory, since your good name was attached to that, and since it works.
(I did test that.)

So I didn't bother to go find the better way in my archives last
night, thinking I must have misremembered it.  I did try to
reconstruct the '* 1^1 > 1' line from memory in my test harness,
but whatever I tried didn't work.  (I suspect I inverted the '>'
and made it a '<' in my short-lived failed attempt.)

And look at the time of my message last night: 2:35 a.m.  I tested
everything, it worked, and I wanted to go to bed. :-)

I think there is a moral to this tale, and it's not really about
the failings of human memory, yours, mine, or anybody's.  It's about
proper attribution.  The unnamed fellow user on our shell provider's
system may have changed something himself and left your name attached.
If he did that, it bothers me!  If I see a code comment attributing
an algorithm or syntax to someone, I want and expect it to be
believable.  That is why in, for example, the Virus Snaggers(tm)
code I make available, I wrote very specifically in the freeware
license agreement that the end-user has every right to change
things, but he is asked to *mark* any changes as his own.  Like
you, I don't want somebody coming back five years hence and saying
"Dallman Ross contributed this bit" and then quote corrupt-looking
crapola.

I say: "Let Dallman Ross make his own mistakes, not yours [spoken
to hypothetical faulty attributors] too!  He makes enough on his own."

  :-)

Seriously, if you see any other weirdness or problems in any suggested
syntax I provide, I am very glad to hear a report about it!


[1] But I just noticed that mutt only shows me the line count --
for which I also have a header in the mail message, anyway -- and
not the byte count.  I've been using mutt for about 4 years now.
I believe there is a way to toggle it to show the byte count, but
I haven't researched that.  In Berkeley Mail and its variants that
I know about, the byte count shows up right in the summary lines,
and I used Mail for about 15 years before switching to mutt.
Here's from the "nail" variant compiled on panix:
 O480 David W. Tamkin    Sat Mar  1 07:36     /5887  Re: message size into 
subject?

Dallman
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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