Re: [PATCH] send-email: Fix Pine address book parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 25 Nov 2008, Junio C Hamano wrote:
> Trent Piepho <tpiepho@xxxxxxxxxxxxx> writes:
>
>> The tech docs I linked to just say pine continues lines with leading space,
>> but not how many spaces exactly.
>
> My reading of the wording "spaces" it uses is that any number.  I agree it
> is underspecified what would happen to them.
>
>> It also appears to only split lines between whitespace and
>> non-whitespace. ...
>> ... like "a b \n   c \n   d\n".  If I didn't eat the leading spaces in the
>> continuations, it would be re-assembled as "a b    c    d".  This might cause
>> an address to become "John     Doe <jdoe@xxxxxxxx>"
>
> Which would still work.  If you had two addresses a and b and smashed them
> together into ab on the other hand it wouldn't.  That is why I asked.

Though if Pine decided to wrap something mid-word, e.g. "a@xxxxx" to
"a@b.\n   com\n" then no eating the leading space would be wrong.

> If you know for sure (e.g. by reading the Pine source) that it only splits
> a line at a whitespace to non-whitespace transition, that it keeps the
> whitespace at the end of the first line, and that the non-whitespace and
> everything after that on the second line (prefixed by extra unspecified
> number of spaces as the continuation sign), then I think what you had in
> your patch is exactly what we want.  I just wanted to make sure you know
> what you are doing, as I do not use Pine nor its address book myself.

I tried all kinds of extreme address book entries and it would never put
spaces at the beginning of a line unless they had been inserted to make a
continuation.

But just for you I downloaded the pine code, which is 20 years old and not
a lot of fun to read.  There isn't any code that just does line wrapping. 
The code that prints out a address book entry will at various points check
if it should output a newline.  And it whatever it prints after those
points isn't allowed to start with space.  The code that reads the entries
eats all the spaces before and after each field.  If long comments are
wrapped, it will change "a   b" into "a\n :  b\n" and effectively does 
s/^ +: / /; when reading it back.  But email address don't get wrapped
that way so we don't need to care about the ':'.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux