procmail
[Top] [All Lists]

Re: formail header concatenation

2009-01-24 10:12:09
On Wed, Jan 21, 2009 at 08:07:56PM +0100, Per Jessen wrote:

LuKreme wrote:

[Regarding the assertion that procmail is "eating" whitespace
when unfolding headerlines:]

On 21-Jan-2009, at 09:14, Per Jessen wrote:

Example header:
Received: from s1.example.com (s1.example.com [127.1.2.3])
<tab>by mail.example.com (Postfix) with ESMTP id 4BF0A9B2CB
<tab>for <alfons(_dot_)aaberg(_at_)enidan(_dot_)com>; Wed, 21 Jan 2009 
16:20:56 +010
(CET)

is concatenated into:

Received: from louiswu4.enidan.ch (louiswu4.enidan.ch
[88.198.9.175])by mail.enidan.com (Postfix) with ESMTP id
4BF0A9B2CBfor <per(_dot_)jessen(_at_)enidan(_dot_)com>; Wed, 21 Jan 2009 
16:20:56
+0100 (CET)

Are you absolutely sure about that?  I haven't done extensive
processing of Received headers in quite a while, but I certainly don't
recall running into that.

Yes, I'm certain - I was debugging some code/script a couple of days
ago, when I hit it.  I'd upgraded a system from SUSE 8.2 to 10.3, and
suddenly some data extraction process stopped working. (formail got
upgraded from 3.15 to 3.22 in that OS upgrade).

It's easily reproduced - you've probably done that already.  If not,
I'll be happy to provide you a couple of sample emails :-)


I didn't believe you the other day, but I have been too busy to
get back to this before now.  I also didn't believe LuKreme's assertion
in the thread that tabs become spaces.  And neither is true with the
version of procmail 3.22 compiled under NetBSD on my ISP or any
other version I have seen so far.  It would be seriously b0rken
if it were true, imho.

Here is the test.  I am running it on the very list message I
am responding to now.  I will find and print the bottommost Received
line from the header.  First, the test rcfile:

 ----------------------------------
 bash-3.2$ cat rc
 
  :0
  * 1^1 ^\/Received:.*
  { LOG = >$MATCH< }
 
  HOST
  ----------------------------------



Now let's run it:

 ----------------------------------
 bash-3.2$ /usr/local/bin/procmail -m rc < per
Received: by mail.enidan.com (Postfix, from userid 9)  id 13FE69C477; Wed,  
21 Jan 2009 20:07:57 +0100 (CET)<
 ----------------------------------

See the whitespace?  There's nothing scrunched together.  I assume it
will get folded again in this email, but as I'm typing it it's all on
one line, and there is no compromised whitespace.  Indeed, there 
is a tab visible after the close-parenthesis on the line.


Let's prove the existence of the tab.  First, a preliminary:

 ----------------------------------
 bash-3.2$ TAB='        '
 ----------------------------------



And now the line, redirecting stderr to stdout so tr will work:


 ----------------------------------
 bash-3.2$ /usr/local/bin/procmail -m rc < per 2>&1 | tr "$TAB" '#'
Received: by mail.enidan.com (Postfix, from userid 9)#id 13FE69C477; Wed,  21 
Jan 2009 20:07:57 +0100 (CET)<
 ----------------------------------

You can clearly see the tab there as "#".


Here's the procmail I'm running:


 ----------------------------------
 bash-3.2$ /usr/local/bin/procmail -v
 procmail v3.22 2001/09/10
 [. . . .]
 ----------------------------------



If you think you can prove something different, please let's see it.
Use my test rcfile shown above, if you want.

My suspicion is ther Per's terminal is not showing him tab chars correctly,
is all.

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