{"thread":{"id":"32544","subject":"[PATCH] git-send-email: treat field names as case-independent","startedAt":"2013-01-07T01:34:58Z","lastAt":"2013-01-07T07:47:10Z","messageCount":4,"participants":["Nickolai Zeldovich","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"206198","messageId":"1357522498-8086-1-git-send-email-nickolai@csail.mit.edu","threadId":"32544","inReplyTo":null,"subject":"[PATCH] git-send-email: treat field names as case-independent","fromName":"Nickolai Zeldovich","fromEmail":"nickolai@csail.mit.edu","sentAt":"2013-01-07T01:34:58Z","receivedAt":"2013-01-07T01:34:58Z","isPatch":true,"sender":{"key":"nickolai@csail.mit.edu","avatar":null},"body":"Field names like To:, Cc:, etc should be treated as case-independent;\nuse a case-insensitive regexp to match them as such.  Previously,\ngit-send-email would send email messages with a lowercase \"cc:\" line in\nthe body without actually sending a copy of the message to that address.\n\nSigned-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>\n---\n git-send-email.perl |   10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 94c7f76..be809e5 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1285,10 +1285,10 @@ foreach my $t (@files) {\n \t\t}\n \n \t\tif (defined $input_format && $input_format eq 'mbox') {\n-\t\t\tif (/^Subject:\\s+(.*)$/) {\n+\t\t\tif (/^Subject:\\s+(.*)$/i) {\n \t\t\t\t$subject = $1;\n \t\t\t}\n-\t\t\telsif (/^From:\\s+(.*)$/) {\n+\t\t\telsif (/^From:\\s+(.*)$/i) {\n \t\t\t\t($author, $author_encoding) = unquote_rfc2047($1);\n \t\t\t\tnext if $suppress_cc{'author'};\n \t\t\t\tnext if $suppress_cc{'self'} and $author eq $sender;\n@@ -1296,14 +1296,14 @@ foreach my $t (@files) {\n \t\t\t\t\t$1, $_) unless $quiet;\n \t\t\t\tpush @cc, $1;\n \t\t\t}\n-\t\t\telsif (/^To:\\s+(.*)$/) {\n+\t\t\telsif (/^To:\\s+(.*)$/i) {\n \t\t\t\tforeach my $addr (parse_address_line($1)) {\n \t\t\t\t\tprintf(\"(mbox) Adding to: %s from line '%s'\\n\",\n \t\t\t\t\t\t$addr, $_) unless $quiet;\n \t\t\t\t\tpush @to, $addr;\n \t\t\t\t}\n \t\t\t}\n-\t\t\telsif (/^Cc:\\s+(.*)$/) {\n+\t\t\telsif (/^Cc:\\s+(.*)$/i) {\n \t\t\t\tforeach my $addr (parse_address_line($1)) {\n \t\t\t\t\tif (unquote_rfc2047($addr) eq $sender) {\n \t\t\t\t\t\tnext if ($suppress_cc{'self'});\n@@ -1325,7 +1325,7 @@ foreach my $t (@files) {\n \t\t\telsif (/^Message-Id: (.*)/i) {\n \t\t\t\t$message_id = $1;\n \t\t\t}\n-\t\t\telsif (!/^Date:\\s/ && /^[-A-Za-z]+:\\s+\\S/) {\n+\t\t\telsif (!/^Date:\\s/i && /^[-A-Za-z]+:\\s+\\S/) {\n \t\t\t\tpush @xh, $_;\n \t\t\t}\n \n-- \n1.7.10.4\n"},{"id":"206203","messageId":"7va9sllljh.fsf@alter.siamese.dyndns.org","threadId":"32544","inReplyTo":"1357522498-8086-1-git-send-email-nickolai@csail.mit.edu","subject":"Re: [PATCH] git-send-email: treat field names as case-independent","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-07T03:27:46Z","receivedAt":"2013-01-07T03:27:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nickolai Zeldovich <nickolai@csail.mit.edu> writes:\n\n> Field names like To:, Cc:, etc should be treated as case-independent;\n> use a case-insensitive regexp to match them as such.  Previously,\n> git-send-email would send email messages with a lowercase \"cc:\" line in\n> the body without actually sending a copy of the message to that address.\n>\n> Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>\n> ---\n\nWhile I think this patch is a sensible thing to do, I at the same\ntime wonder who is writing \"cc:\" in the lowercase in the first\nplace, and if that is one of our tools, we should fix that part as\nwell.  Such a header would leak out to the payload given to the\nunderlying sendmail, doesn't it?\n\nLeaking such lowercased headers of course is not a crime (the\nheaders are case insensitive), but they look ugly.\n\n>  git-send-email.perl |   10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 94c7f76..be809e5 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1285,10 +1285,10 @@ foreach my $t (@files) {\n>  \t\t}\n>  \n>  \t\tif (defined $input_format && $input_format eq 'mbox') {\n> -\t\t\tif (/^Subject:\\s+(.*)$/) {\n> +\t\t\tif (/^Subject:\\s+(.*)$/i) {\n>  \t\t\t\t$subject = $1;\n>  \t\t\t}\n> -\t\t\telsif (/^From:\\s+(.*)$/) {\n> +\t\t\telsif (/^From:\\s+(.*)$/i) {\n>  \t\t\t\t($author, $author_encoding) = unquote_rfc2047($1);\n>  \t\t\t\tnext if $suppress_cc{'author'};\n>  \t\t\t\tnext if $suppress_cc{'self'} and $author eq $sender;\n> @@ -1296,14 +1296,14 @@ foreach my $t (@files) {\n>  \t\t\t\t\t$1, $_) unless $quiet;\n>  \t\t\t\tpush @cc, $1;\n>  \t\t\t}\n> -\t\t\telsif (/^To:\\s+(.*)$/) {\n> +\t\t\telsif (/^To:\\s+(.*)$/i) {\n>  \t\t\t\tforeach my $addr (parse_address_line($1)) {\n>  \t\t\t\t\tprintf(\"(mbox) Adding to: %s from line '%s'\\n\",\n>  \t\t\t\t\t\t$addr, $_) unless $quiet;\n>  \t\t\t\t\tpush @to, $addr;\n>  \t\t\t\t}\n>  \t\t\t}\n> -\t\t\telsif (/^Cc:\\s+(.*)$/) {\n> +\t\t\telsif (/^Cc:\\s+(.*)$/i) {\n>  \t\t\t\tforeach my $addr (parse_address_line($1)) {\n>  \t\t\t\t\tif (unquote_rfc2047($addr) eq $sender) {\n>  \t\t\t\t\t\tnext if ($suppress_cc{'self'});\n> @@ -1325,7 +1325,7 @@ foreach my $t (@files) {\n>  \t\t\telsif (/^Message-Id: (.*)/i) {\n>  \t\t\t\t$message_id = $1;\n>  \t\t\t}\n> -\t\t\telsif (!/^Date:\\s/ && /^[-A-Za-z]+:\\s+\\S/) {\n> +\t\t\telsif (!/^Date:\\s/i && /^[-A-Za-z]+:\\s+\\S/) {\n>  \t\t\t\tpush @xh, $_;\n>  \t\t\t}\n"},{"id":"206204","messageId":"CADGQE7HTB+s2=PWhMZ=1BpU9nruhx5OBhKOY-ngdZJz=vC61uQ@mail.gmail.com","threadId":"32544","inReplyTo":"7va9sllljh.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-send-email: treat field names as case-independent","fromName":"Nickolai Zeldovich","fromEmail":"nickolai@csail.mit.edu","sentAt":"2013-01-07T03:38:15Z","receivedAt":"2013-01-07T03:38:15Z","isPatch":true,"sender":{"key":"nickolai@csail.mit.edu","avatar":null},"body":"On Sun, Jan 6, 2013 at 10:27 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> While I think this patch is a sensible thing to do, I at the same\n> time wonder who is writing \"cc:\" in the lowercase in the first\n> place, and if that is one of our tools, we should fix that part as\n> well.  Such a header would leak out to the payload given to the\n> underlying sendmail, doesn't it?\n\nIn my case, I wrote the \"cc:\" headers by hand; it was not a result of\nany automated tool.  (Yes, the header makes it into the message\npayload.  This makes the bug all the more annoying: other people's\nreplies get cc:ed to the right address, but the original message never\ngets sent there.)\n\nNickolai.\n"},{"id":"206214","messageId":"7vsj6djuyp.fsf@alter.siamese.dyndns.org","threadId":"32544","inReplyTo":"CADGQE7HTB+s2=PWhMZ=1BpU9nruhx5OBhKOY-ngdZJz=vC61uQ@mail.gmail.com","subject":"Re: [PATCH] git-send-email: treat field names as case-independent","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-07T07:47:10Z","receivedAt":"2013-01-07T07:47:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nickolai Zeldovich <nickolai@csail.mit.edu> writes:\n\n> On Sun, Jan 6, 2013 at 10:27 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> While I think this patch is a sensible thing to do, I at the same\n>> time wonder who is writing \"cc:\" in the lowercase in the first\n>> place, and if that is one of our tools, we should fix that part as\n>> well.  Such a header would leak out to the payload given to the\n>> underlying sendmail, doesn't it?\n>\n> In my case, I wrote the \"cc:\" headers by hand; it was not a result of\n> any automated tool.\n\nOk, thanks for shrinking the list of things that worries me by one ;-)\n"}]}