All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Trent Piepho <tpiepho@freescale.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH] send-email: Fix Pine address book parsing
Date: Tue, 25 Nov 2008 20:58:01 -0800	[thread overview]
Message-ID: <7vod03hyna.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1227668100-5563-1-git-send-email-tpiepho@freescale.com> (Trent Piepho's message of "Tue, 25 Nov 2008 18:55:00 -0800")

Trent Piepho <tpiepho@freescale.com> writes:

> See:  http://www.washington.edu/pine/tech-notes/low-level.html
>
> Entries with a fcc or comment field after the address weren't parsed
> correctly.
>
> Continuation lines, identified by leading spaces, were also not handled.
>
> Distribution lists which had ( ) around a list of addresses did not have
> the parenthesis removed.

> +	pine => sub { my $fh = shift; my $f='\t[^\t]*';
> +	        for (my $x = ''; defined($x); $x = $_) {
> +			chomp $x;
> +		        $x .= $1 while(defined($_ = <$fh>) && /^ +(.*)$/);
> +			$x =~ /^(\S+)$f\t\(?([^\t]+?)\)?(:?$f){0,2}$/ or next;

Hmm, so you chomp each continuation line with /^ +(.*)$/ and concatenate
that to the hold buffer ($x) as long as you see continuation lines,
a non-continuation line that you read ahead is given to the next round
(the third part of for(;;) control), checked if you hit an EOF and then
chomped.  Which means the complicated regexp about the parentheses is
applied to a logical single line in $x that does not have any newline in
it, right?

I wonder what this does:

	$x .= $1 while (defined($_ = <$fh>) && /^ +(.*)$/);

when you have "a b" in $x and feed " c\n d\ne\n" to it.  When it leaves
the loop, you would have "e\n" in $_ for the next round, and "a bcd" (note
that "bcd" becomes one word) in $x, which I suspect may not be what you
want.

But I do not use Pine nor its aliases file.

  reply	other threads:[~2008-11-26  4:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-26  2:55 [PATCH] send-email: Fix Pine address book parsing Trent Piepho
2008-11-26  4:58 ` Junio C Hamano [this message]
2008-11-26  5:59   ` Trent Piepho
2008-11-26  6:44     ` Junio C Hamano
2008-11-26 11:13       ` Trent Piepho
2008-11-26 19:46         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vod03hyna.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=tpiepho@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.