Skip to contentSkip to conversation

Check and document the options to prevent mistakes.

PATCH In review Eric W. Biederman 2 participants 4 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Check and document the options to prevent mistakes.

When multiple recipients are given to git-send-email on the same --cc line the code does not properly handle it.

Full and proper parsing of the email addresses so I can detect which commas mean a new email address is more than I care to implement.

In particular this email address: "bibo,mao" <[email protected]> must not be treated as two email addresses.

So this patch simply treats all commas in recipient lists as an error and fails if one is given.

At the same time it documents that git-send-email wants multiple instances of --cc specified on the command line if you want to cc multiple recipients.

---

 Documentation/git-send-email.txt |    9 +++++++++
 git-send-email.perl              |   14 ++++++++++++++
 2 files changed, 23 insertions(+)
Documentation/git-send-email.txt +9 -0
index ad1b9cf..481b3f5 100644
@@ -24,9 +24,16 @@ OPTIONS
 -------
 The options available are:
 
+--bcc::
+	Specify a "Bcc:" value for each email.
+
+	The --bcc option must be repeated for each user you want on the bcc list.
+
 --cc::
 	Specify a starting "Cc:" value for each email.
 
+	The --cc option must be repeated for each user you want on the cc list.
+
 --chain-reply-to, --no-chain-reply-to::
 	If this is set, each email will be sent as a reply to the previous
 	email sent.  If disabled with "--no-chain-reply-to", all emails after
@@ -76,6 +83,8 @@ The options available are:
 	Generally, this will be the upstream maintainer of the
 	project involved.
 
+	The --to option must be repeated for each user you want on the to list.
+
 
 Author
 ------
git-send-email.perl +14 -0
index 7b1cca7..c5d9e73 100755
@@ -65,6 +65,20 @@ my $rc = GetOptions("from=s" => \$from,
 		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
 	 );
 
+# Verify the user input
+
+foreach my $entry (@to) {
+	die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
+}
+
+foreach my $entry (@initial_cc) {
+	die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/;
+}
+
+foreach my $entry (@bcclist) {
+	die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/;
+}
+
 # Now, let's fill any that aren't set in with defaults:
 
 sub gitvar {
#1 lore raw

git-send-email.perl my $rc = GetOptions("from=s" => \$from, · line 73

Quoted 6 lines · [email protected] (Eric W. Biederman) writes:
git-send-email.perl +6 -0
+# Verify the user input
+
+foreach my $entry (@to) {
+	die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
+}
+

Perhaps, avoiding double negation would be easier on the eyes.

        die ... if $entry =~ /,/

Does it grok '"Biederman, Eric W." <[email protected]>' some people seem to do properly, or do we care (I personally don't)?

#2 lore raw
Quoted 11 lines · Junio C Hamano

git-send-email.perl my $rc = GetOptions("from=s" => \$from, · line 73

Quoted 6 lines · [email protected] (Eric W. Biederman) writes:
git-send-email.perl +6 -0
+# Verify the user input
+
+foreach my $entry (@to) {
+	die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
+}
+

Perhaps, avoiding double negation would be easier on the eyes.

Quoted 1 line
        die ... if $entry =~ /,/

Sure double negation does get confusing. I think I forgot about that last if form. My perl is rusty from disuse.

Quoted 2 lines

Does it grok '"Biederman, Eric W." <[email protected]>' some people seem to do properly, or do we care (I personally don't)?

Nope. If figure that is lesser of two evils. If I could properly grok that I would make it do things properly and parse a --cc option for multiple email addresses.

I think you can still specify those interesting forms in an alias file, like .mailrc.

The important thing is not to do a mailing and the discover your recipients didn't get the email.

Eric

#3 lore raw
Quoted 6 lines · [email protected] (Eric W. Biederman) writes:
Quoted 2 lines · Junio C Hamano

Does it grok '"Biederman, Eric W." <[email protected]>' some people seem to do properly, or do we care (I personally don't)?

Nope. If figure that is lesser of two evils.

Fair enough.