{"thread":{"id":"18664","subject":"[PATCH 0/4] send-email: correct various issues","startedAt":"2009-03-31T16:22:10Z","lastAt":"2009-04-01T08:33:04Z","messageCount":7,"participants":["Jay Soffian","Jeff King","Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"110025","messageId":"cover.1238516122.git.jaysoffian@gmail.com","threadId":"18664","inReplyTo":null,"subject":"[PATCH 0/4] send-email: correct various issues","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-31T16:22:10Z","receivedAt":"2009-03-31T16:22:10Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Junio, these are technically all independent bug fixes, but they were\nminor, so I've lumped them together. I figured you'd just add them to\nthe js/send-email topic anyway. Also, I apologize for causing trouble in\nmaster. :-(\n\nBjÃ¶rn, I've cc'd you for 3/4, which caused me to notice the problem that\nled to 4/4. Uwe, I've cc'd you for 4/4.\n\nJay Soffian (4):\n  send-email: don't attempt to prompt if tty is closed\n  send-email: ask_default should apply to all emails, not just the\n    first\n  send-email: correct two tests which were going interactive\n  send-email: ensure quoted addresses are rfc2047 encoded\n\n git-send-email.perl   |    9 ++++++---\n t/t9001-send-email.sh |   25 +++++++++++++++++++++----\n 2 files changed, 27 insertions(+), 7 deletions(-)\n"},{"id":"110027","messageId":"e439cc23328dc25d153baed21f6ad7d90106eb03.1238516122.git.jaysoffian@gmail.com","threadId":"18664","inReplyTo":"cover.1238516122.git.jaysoffian@gmail.com","subject":"[PATCH 1/4] send-email: don't attempt to prompt if tty is closed","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-31T16:22:11Z","receivedAt":"2009-03-31T16:22:11Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Attempting to prompt when the tty is closed (typically when running from\ncron) is pointless and emits a warning. This patch causes ask() to\nreturn early, squelching the warning.\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\n git-send-email.perl |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 5916c86..d790660 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -612,6 +612,9 @@ sub ask {\n \tmy $default = $arg{default};\n \tmy $resp;\n \tmy $i = 0;\n+\treturn defined $default ? $default : undef\n+\t\tunless defined $term->IN and defined fileno($term->IN) and\n+\t\t       defined $term->OUT and defined fileno($term->OUT);\n \twhile ($i++ < 10) {\n \t\t$resp = $term->readline($prompt);\n \t\tif (!defined $resp) { # EOF\n-- \n1.6.2.1.427.g15408\n"},{"id":"110028","messageId":"77c8a8123cb66821775b03fa0f3d2744de82b79b.1238516122.git.jaysoffian@gmail.com","threadId":"18664","inReplyTo":"e439cc23328dc25d153baed21f6ad7d90106eb03.1238516122.git.jaysoffian@gmail.com","subject":"[PATCH 2/4] send-email: ask_default should apply to all emails, not just the first","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-31T16:22:12Z","receivedAt":"2009-03-31T16:22:12Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Commit 6e18251 made the \"Send this email?\" prompt assume yes if confirm\n= \"inform\" when it was unable to get a valid response. However, the\n\"yes\" assumption only worked correctly for the first email. This commit\nfixes the issue and confirms the fix my modifying the existing test for\nthe prompt to send multiple emails.\n\nReported by Matthieu Moy <Matthieu.Moy@imag.fr>\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\n git-send-email.perl   |    3 +--\n t/t9001-send-email.sh |    4 +++-\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d790660..fc153f9 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -687,7 +687,7 @@ if ($compose && $compose > 0) {\n \n # Variables we set as part of the loop over files\n our ($message_id, %mail, $subject, $reply_to, $references, $message,\n-\t$needs_confirm, $message_num);\n+\t$needs_confirm, $message_num, $ask_default);\n \n sub extract_valid_address {\n \tmy $address = shift;\n@@ -845,7 +845,6 @@ X-Mailer: git-send-email $gitversion\n \n \tif ($needs_confirm && !$dry_run) {\n \t\tprint \"\\n$header\\n\";\n-\t\tmy $ask_default;\n \t\tif ($needs_confirm eq \"inform\") {\n \t\t\t$confirm_unconfigured = 0; # squelch this message for the rest of this run\n \t\t\t$ask_default = \"y\"; # assume yes on EOF since user hasn't explicitly asked for confirmation\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex b4de98c..195ff8b 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -462,12 +462,14 @@ test_expect_success 'confirm by default (due to --compose)' '\n test_expect_success 'confirm detects EOF (inform assumes y)' '\n \tCONFIRM=$(git config --get sendemail.confirm) &&\n \tgit config --unset sendemail.confirm &&\n+\trm -fr outdir &&\n+\tgit format-patch -2 -o outdir &&\n \tGIT_SEND_EMAIL_NOTTY=1 \\\n \t\tgit send-email \\\n \t\t\t--from=\"Example <nobody@example.com>\" \\\n \t\t\t--to=nobody@example.com \\\n \t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n-\t\t\t$patches < /dev/null\n+\t\t\toutdir/*.patch < /dev/null\n \tret=\"$?\"\n \tgit config sendemail.confirm ${CONFIRM:-never}\n \ttest $ret = \"0\"\n-- \n1.6.2.1.427.g15408\n"},{"id":"110030","messageId":"232681e20e15a61defb73a1645fd2c6b6aadd751.1238516122.git.jaysoffian@gmail.com","threadId":"18664","inReplyTo":"77c8a8123cb66821775b03fa0f3d2744de82b79b.1238516122.git.jaysoffian@gmail.com","subject":"[PATCH 3/4] send-email: correct two tests which were going interactive","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-31T16:22:13Z","receivedAt":"2009-03-31T16:22:13Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Commit 67f1fe5 added two tests which went interactive under the\ndash shell. This commit corrects the issue. Reported by\nBjörn Steinbrink <B.Steinbrink@gmx.de>\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\n t/t9001-send-email.sh |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 195ff8b..84238f7 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -478,7 +478,8 @@ test_expect_success 'confirm detects EOF (inform assumes y)' '\n test_expect_success 'confirm detects EOF (auto causes failure)' '\n \tCONFIRM=$(git config --get sendemail.confirm) &&\n \tgit config sendemail.confirm auto &&\n-\tGIT_SEND_EMAIL_NOTTY=1 \\\n+\tGIT_SEND_EMAIL_NOTTY=1 &&\n+\texport GIT_SEND_EMAIL_NOTTY &&\n \t\ttest_must_fail git send-email \\\n \t\t\t--from=\"Example <nobody@example.com>\" \\\n \t\t\t--to=nobody@example.com \\\n@@ -492,8 +493,9 @@ test_expect_success 'confirm detects EOF (auto causes failure)' '\n test_expect_success 'confirm doesnt loop forever' '\n \tCONFIRM=$(git config --get sendemail.confirm) &&\n \tgit config sendemail.confirm auto &&\n-\tyes \"bogus\" | GIT_SEND_EMAIL_NOTTY=1 \\\n-\t\ttest_must_fail git send-email \\\n+\tGIT_SEND_EMAIL_NOTTY=1 &&\n+\texport GIT_SEND_EMAIL_NOTTY &&\n+\t\tyes \"bogus\" | test_must_fail git send-email \\\n \t\t\t--from=\"Example <nobody@example.com>\" \\\n \t\t\t--to=nobody@example.com \\\n \t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n-- \n1.6.2.1.427.g15408\n"},{"id":"110029","messageId":"15408fd6016806764cbd501cfcb54c726662f359.1238516122.git.jaysoffian@gmail.com","threadId":"18664","inReplyTo":"232681e20e15a61defb73a1645fd2c6b6aadd751.1238516122.git.jaysoffian@gmail.com","subject":"[PATCH 4/4] send-email: ensure quoted addresses are rfc2047 encoded","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-31T16:22:14Z","receivedAt":"2009-03-31T16:22:14Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"sanitize_address assumes that quoted addresses (e.g., \"first last\"\n<first.last@example.com) do not need rfc2047 encoding, but this is\nnot always the case.\n\nFor example, various places in send-email extract addresses using\nparse_address_line. parse_address_line returns the addresses already\nquoted (e.g., \"first last\" <first.last@example.com), but not rfc2047\nencoded.\n\nThis patch makes sanitize_address stricter about what needs rfc2047\nencoding and adds a test demonstrating where I noticed the problem.\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\n git-send-email.perl   |    3 ++-\n t/t9001-send-email.sh |   13 +++++++++++++\n 2 files changed, 15 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex fc153f9..6bbdfec 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -776,12 +776,13 @@ sub sanitize_address\n \t}\n \n \t# if recipient_name is already quoted, do nothing\n-\tif ($recipient_name =~ /^(\".*\"|=\\?utf-8\\?q\\?.*\\?=)$/) {\n+\tif ($recipient_name =~ /^(\"[[:ascii:]]*\"|=\\?utf-8\\?q\\?.*\\?=)$/) {\n \t\treturn $recipient;\n \t}\n \n \t# rfc2047 is needed if a non-ascii char is included\n \tif ($recipient_name =~ /[^[:ascii:]]/) {\n+\t\t$recipient_name =~ s/^\"(.*)\"$/$1/;\n \t\t$recipient_name = quote_rfc2047($recipient_name);\n \t}\n \ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 84238f7..192b97b 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -505,6 +505,19 @@ test_expect_success 'confirm doesnt loop forever' '\n \ttest $ret = \"0\"\n '\n \n+test_expect_success 'utf8 Cc is rfc2047 encoded' '\n+\tclean_fake_sendmail &&\n+\trm -fr outdir &&\n+\tgit format-patch -1 -o outdir --cc=\"Ã Ã©Ã¬Ã¶Ãº <utf8@example.com>\" &&\n+\tgit send-email \\\n+\t--from=\"Example <nobody@example.com>\" \\\n+\t--to=nobody@example.com \\\n+\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\toutdir/*.patch &&\n+\tgrep \"^Cc:\" msgtxt1 |\n+\tgrep \"=?utf-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>\"\n+'\n+\n test_expect_success '--compose adds MIME for utf8 body' '\n \tclean_fake_sendmail &&\n \t(echo \"#!$SHELL_PATH\" &&\n-- \n1.6.2.1.427.g15408\n"},{"id":"110053","messageId":"20090331194606.GA23184@coredump.intra.peff.net","threadId":"18664","inReplyTo":"232681e20e15a61defb73a1645fd2c6b6aadd751.1238516122.git.jaysoffian@gmail.com","subject":"Re: [PATCH 3/4] send-email: correct two tests which were going interactive","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-31T19:46:06Z","receivedAt":"2009-03-31T19:46:06Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 31, 2009 at 12:22:13PM -0400, Jay Soffian wrote:\n\n> Commit 67f1fe5 added two tests which went interactive under the\n> dash shell. This commit corrects the issue. Reported by\n> Björn Steinbrink <B.Steinbrink@gmx.de>\n\nThanks. I was seeing the same issue as Björn, and this fixes it for me.\n\n-Peff\n"},{"id":"110104","messageId":"vpqiqlolqnz.fsf@bauges.imag.fr","threadId":"18664","inReplyTo":"cover.1238516122.git.jaysoffian@gmail.com","subject":"Re: [PATCH 0/4] send-email: correct various issues","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-04-01T08:33:04Z","receivedAt":"2009-04-01T08:33:04Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> Junio, these are technically all independent bug fixes, but they were\n> minor, so I've lumped them together. I figured you'd just add them to\n> the js/send-email topic anyway. Also, I apologize for causing trouble in\n> master. :-(\n\nBut I shall thank you for fixing them ;-).\n\n> Jay Soffian (4):\n>   send-email: don't attempt to prompt if tty is closed\n\nWorks, I don't have garbage anymore in my logs.\n\n>   send-email: ask_default should apply to all emails, not just the\n>     first\n\nWorks, I get the informational message in my logs once, and all the\nmails are sent successfully.\n\n>   send-email: correct two tests which were going interactive\n>   send-email: ensure quoted addresses are rfc2047 encoded\n\nDidn't test these.\n\n-- \nMatthieu\n"}]}