From: Junio C Hamano <gitster@pobox.com>
To: Ian Hilt <ian.hilt@gmx.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Pierre Habouzit <madcoder@debian.org>
Subject: Re: [PATCH v2] Edit recipient addresses with the --compose flag
Date: Wed, 12 Nov 2008 19:18:50 -0800 [thread overview]
Message-ID: <7vskpwia91.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1226544602-1839-1-git-send-email-ian.hilt@gmx.com> (Ian Hilt's message of "Wed, 12 Nov 2008 21:50:02 -0500")
Ian Hilt <ian.hilt@gmx.com> writes:
> Sometimes specifying the recipient addresses can be tedious on the
> command-line. This commit allows the user to edit the recipient
> addresses in their editor of choice.
>
> Signed-off-by: Ian Hilt <ian.hilt@gmx.com>
> ---
> Here's an updated commit with improved regex's from Junio and Francis.
This heavily depends on Pierre's patch, so I am CC'ing him for comments.
Until his series settles down, I cannot apply this anyway.
> @@ -489,6 +492,9 @@ GIT: for the patch you are writing.
> GIT:
> GIT: Clear the body content if you don't wish to send a summary.
> From: $tpl_sender
> +To: $tpl_to
> +Cc: $tpl_cc
> +Bcc: $tpl_bcc
> Subject: $tpl_subject
> In-Reply-To: $tpl_reply_to
>
> @@ -512,9 +518,31 @@ EOT
> open(C,"<",$compose_filename)
> or die "Failed to open $compose_filename : " . $!;
>
> + local $/;
> + my $c_file = <C>;
> + $/ = "\n";
> + close(C);
> +
> + my (@tmp_to, @tmp_cc, @tmp_bcc);
> +
> + if ($c_file =~ /^To:\s*(\S.+?)\s*\nCc:/ism) {
> + @tmp_to = get_recipients($1);
> + }
Why "\S.+?" and not "\S.*?"? A local user whose login name is 'q' is
disallowed?
Why does the user must keep "Cc:" in order for this new code to pick up
the list of recipients? In other words, you are forbidding the user from
removing the entire "Cc:" line, even when the message should not be Cc'ed
to anywhere. Instead there has to remain an empty Cc: line. Worse yet,
such an empty "Cc:" line is printed to C2 with your patch and eventually
fed to sendmail. I think it is a violation of 2822 to have Cc: that is
empty, as the format is specified as:
cc = "Cc:" address-list CRLF
bcc = "Bcc:" (address-list / [CFWS]) CRLF
address-list = (address *("," address)) / obs-addr-list
> + if ($c_file =~ /^Cc:\s*(\S.+?)\s*\nBcc:/ism) {
> + @tmp_cc = get_recipients($1);
> + }
> + if ($c_file =~ /^Bcc:\s*(\S.+?)\s*\nSubject:/ism) {
> + @tmp_bcc = get_recipients($1);
> + }
Exactly the same comment applies to Bcc and Subject part of the parsing.
I think the parsing code you introduced simply suck. Why isn't it done as
a part of the main loop to read the same file that already exists?
Unlike your additional code above that reads the whole file into a scalar
only to discard, the existing main loop processes one line at a file
(which should be more memory efficient), and you are not handling the
header continuation line anyway, processing one line at a time would make
your code much simpler (for one thing, you do not have to do /sm at all).
Also it won't be confused as your version would if the message happens to
have "To:" or "Cc:" in the message part, thanks to $in_body variable check
that is already in the code.
next prev parent reply other threads:[~2008-11-13 3:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-13 2:50 [PATCH v2] Edit recipient addresses with the --compose flag Ian Hilt
2008-11-13 3:18 ` Junio C Hamano [this message]
2008-11-14 2:10 ` Ian Hilt
2008-11-14 3:31 ` Junio C Hamano
2008-11-14 16:58 ` Ian Hilt
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=7vskpwia91.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ian.hilt@gmx.com \
--cc=madcoder@debian.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).