{"thread":{"id":"39471","subject":"[PATCH 2/9] send-email: visually distinguish sendmail aliases parser warnings","startedAt":"2015-05-31T22:29:22Z","lastAt":"2015-06-01T22:44:49Z","messageCount":15,"participants":["Eric Sunshine","Allen Hubbe"],"isPatch":true,"patchVersion":1,"patchTotal":9},"messages":[{"id":"262537","messageId":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":null,"subject":"[PATCH 0/9] send-email: add sendmail aliases line continuation support","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:22Z","receivedAt":"2015-05-31T22:29:22Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"This series adds line continuation support for sendmail aliases.\nIt extends basic sendmail aliases functionality implemented by\nah/send-email-sendmail-alias (currently d1205b07 in 'pu')\n\nEric Sunshine (9):\n  send-email: further document missing sendmail aliases functionality\n  send-email: visually distinguish sendmail aliases parser warnings\n  send-email: drop noise comments which merely repeat what code says\n  send-email: fix style: cuddle 'elsif' and 'else' with closing brace\n  send-email: refactor sendmail aliases parser\n  send-email: simplify sendmail aliases comment and blank line\n    recognizer\n  send-email: implement sendmail aliases line continuation support\n  t9001: refactor sendmail aliases test infrastructure\n  t9001: add sendmail aliases line continuation tests\n\n Documentation/git-send-email.txt |  5 ++-\n git-send-email.perl              | 54 ++++++++++++++-------------\n t/t9001-send-email.sh            | 81 +++++++++++++++++++++++++++++++---------\n 3 files changed, 94 insertions(+), 46 deletions(-)\n\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262539","messageId":"1433111371-19573-2-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 1/9] send-email: further document missing sendmail aliases functionality","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:23Z","receivedAt":"2015-05-31T22:29:23Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Sendmail aliases[1] supports expansion to a file (\"/path/name\") or\npipe (\"|command\"), as well as file inclusion (\":include: /path/name\"),\nhowever, our implementation does not support such functionality.\n\n[1]: https://www.freebsd.org/cgi/man.cgi?query=aliases&sektion=5\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n Documentation/git-send-email.txt | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex b48a764..e6d466e 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -396,6 +396,9 @@ sendmail;;\n \tcontain a `\"` symbol are ignored.\n *\tLine continuations are not supported: lines that start with\n \twhitespace characters, or end with a `\\` symbol are ignored.\n+*\tRedirection to a file (`/path/name`) or pipe (`|command`) is not\n+\tsupported.\n+*\tFile inclusion (`:include: /path/name`) is not supported.\n *\tWarnings are printed on the standard error output for any\n \texplicitly unsupported constructs, and any other lines that are not\n \trecognized by the parser.\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262536","messageId":"1433111371-19573-3-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 2/9] send-email: visually distinguish sendmail aliases parser warnings","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:24Z","receivedAt":"2015-05-31T22:29:24Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Although emitted to stderr, warnings from the sendmail aliases parser\nare not visually distinguished as such, and thus can easily be\noverlooked in the normal noisy send-email output.\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n\nThis prepends lowercase \"warning:\" rather than uppercase since lowercase\nis used elsewhere in git-send-email.perl for diagnostic message\nprefixes.\n\n git-send-email.perl | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 6bedf74..819f87e 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -522,12 +522,12 @@ my %parse_alias = (\n \n \t\t# warn on lines that contain quotes\n \t\telsif (/\"/) {\n-\t\t\tprint STDERR \"sendmail alias with quotes is not supported: $_\\n\";\n+\t\t\tprint STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n \t\t}\n \n \t\t# warn on lines that continue\n \t\telsif (/^\\s|\\\\$/) {\n-\t\t\tprint STDERR \"sendmail continuation line is not supported: $_\\n\";\n+\t\t\tprint STDERR \"warning: sendmail continuation line is not supported: $_\\n\";\n \t\t}\n \n \t\t# recognize lines that look like an alias\n@@ -538,7 +538,7 @@ my %parse_alias = (\n \n \t\t# warn on lines that are not recognized\n \t\telse {\n-\t\t\tprint STDERR \"sendmail line is not recognized: $_\\n\";\n+\t\t\tprint STDERR \"warning: sendmail line is not recognized: $_\\n\";\n \t\t}}},\n \n \tgnus => sub { my $fh = shift; while (<$fh>) {\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262538","messageId":"1433111371-19573-4-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 3/9] send-email: drop noise comments which merely repeat what code says","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:25Z","receivedAt":"2015-05-31T22:29:25Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n git-send-email.perl | 5 -----\n 1 file changed, 5 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 819f87e..0b18682 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -517,26 +517,21 @@ my %parse_alias = (\n \t\t      } },\n \n \tsendmail => sub { my $fh = shift; while (<$fh>) {\n-\t\t# ignore blank lines and comment lines\n \t\tif (/^\\s*(?:#.*)?$/) { }\n \n-\t\t# warn on lines that contain quotes\n \t\telsif (/\"/) {\n \t\t\tprint STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n \t\t}\n \n-\t\t# warn on lines that continue\n \t\telsif (/^\\s|\\\\$/) {\n \t\t\tprint STDERR \"warning: sendmail continuation line is not supported: $_\\n\";\n \t\t}\n \n-\t\t# recognize lines that look like an alias\n \t\telsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n \t\t\tmy ($alias, $addr) = ($1, $2);\n \t\t\t$aliases{$alias} = [ split_addrs($addr) ];\n \t\t}\n \n-\t\t# warn on lines that are not recognized\n \t\telse {\n \t\t\tprint STDERR \"warning: sendmail line is not recognized: $_\\n\";\n \t\t}}},\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262544","messageId":"1433111371-19573-5-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 4/9] send-email: fix style: cuddle 'elsif' and 'else' with closing brace","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:26Z","receivedAt":"2015-05-31T22:29:26Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n git-send-email.perl | 17 +++++------------\n 1 file changed, 5 insertions(+), 12 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 0b18682..1380e6e 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -517,22 +517,15 @@ my %parse_alias = (\n \t\t      } },\n \n \tsendmail => sub { my $fh = shift; while (<$fh>) {\n-\t\tif (/^\\s*(?:#.*)?$/) { }\n-\n-\t\telsif (/\"/) {\n+\t\tif (/^\\s*(?:#.*)?$/) {\n+\t\t} elsif (/\"/) {\n \t\t\tprint STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n-\t\t}\n-\n-\t\telsif (/^\\s|\\\\$/) {\n+\t\t} elsif (/^\\s|\\\\$/) {\n \t\t\tprint STDERR \"warning: sendmail continuation line is not supported: $_\\n\";\n-\t\t}\n-\n-\t\telsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n+\t\t} elsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n \t\t\tmy ($alias, $addr) = ($1, $2);\n \t\t\t$aliases{$alias} = [ split_addrs($addr) ];\n-\t\t}\n-\n-\t\telse {\n+\t\t} else {\n \t\t\tprint STDERR \"warning: sendmail line is not recognized: $_\\n\";\n \t\t}}},\n \n-- \n2.4.2.538.g5f4350e\n"},{"id":"262542","messageId":"1433111371-19573-6-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 5/9] send-email: refactor sendmail aliases parser","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:27Z","receivedAt":"2015-05-31T22:29:27Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"The sendmail aliases parser inlined into %parse_alias is already\nuncomfortably large and is expected to grow as additional functionality\nis implemented, so extract it to improve manageability.\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n git-send-email.perl | 38 ++++++++++++++++++++++++--------------\n 1 file changed, 24 insertions(+), 14 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 1380e6e..76bb499 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -487,6 +487,29 @@ sub split_addrs {\n }\n \n my %aliases;\n+\n+sub parse_sendmail_alias {\n+\tlocal $_ = shift;\n+\tif (/\"/) {\n+\t\tprint STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n+\t} elsif (/^\\s|\\\\$/) {\n+\t\tprint STDERR \"warning: sendmail continuation line is not supported: $_\\n\";\n+\t} elsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n+\t\tmy ($alias, $addr) = ($1, $2);\n+\t\t$aliases{$alias} = [ split_addrs($addr) ];\n+\t} else {\n+\t\tprint STDERR \"warning: sendmail line is not recognized: $_\\n\";\n+\t}\n+}\n+\n+sub parse_sendmail_aliases {\n+\tmy $fh = shift;\n+\twhile (<$fh>) {\n+\t\tif (/^\\s*(?:#.*)?$/) { next; }\n+\t\tparse_sendmail_alias($_);\n+\t}\n+}\n+\n my %parse_alias = (\n \t# multiline formats can be supported in the future\n \tmutt => sub { my $fh = shift; while (<$fh>) {\n@@ -515,20 +538,7 @@ my %parse_alias = (\n \t\t\t       $aliases{$alias} = [ split_addrs($addr) ];\n \t\t\t  }\n \t\t      } },\n-\n-\tsendmail => sub { my $fh = shift; while (<$fh>) {\n-\t\tif (/^\\s*(?:#.*)?$/) {\n-\t\t} elsif (/\"/) {\n-\t\t\tprint STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n-\t\t} elsif (/^\\s|\\\\$/) {\n-\t\t\tprint STDERR \"warning: sendmail continuation line is not supported: $_\\n\";\n-\t\t} elsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n-\t\t\tmy ($alias, $addr) = ($1, $2);\n-\t\t\t$aliases{$alias} = [ split_addrs($addr) ];\n-\t\t} else {\n-\t\t\tprint STDERR \"warning: sendmail line is not recognized: $_\\n\";\n-\t\t}}},\n-\n+\tsendmail => \\&parse_sendmail_aliases,\n \tgnus => sub { my $fh = shift; while (<$fh>) {\n \t\tif (/\\(define-mail-alias\\s+\"(\\S+?)\"\\s+\"(\\S+?)\"\\)/) {\n \t\t\t$aliases{$1} = [ $2 ];\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262543","messageId":"1433111371-19573-7-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 6/9] send-email: simplify sendmail aliases comment and blank line recognizer","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:28Z","receivedAt":"2015-05-31T22:29:28Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Replace unnecessarily complex regular expression for recognizing comment\nand blanks lines in sendmail aliases with idiomatic expressions which\ncan be easily understood at a glance.\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n git-send-email.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 76bb499..e777bd3 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -505,7 +505,7 @@ sub parse_sendmail_alias {\n sub parse_sendmail_aliases {\n \tmy $fh = shift;\n \twhile (<$fh>) {\n-\t\tif (/^\\s*(?:#.*)?$/) { next; }\n+\t\tnext if /^\\s*$/ || /^\\s*#/;\n \t\tparse_sendmail_alias($_);\n \t}\n }\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262541","messageId":"1433111371-19573-8-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 7/9] send-email: implement sendmail aliases line continuation support","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:29Z","receivedAt":"2015-05-31T22:29:29Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Logical lines in sendmail aliases files can be spread over multiple\nphysical lines[1]. A line beginning with whitespace is folded into the\npreceding line. A line ending with '\\' consumes the following line.\n\n[1]: https://www.freebsd.org/cgi/man.cgi?query=aliases&sektion=5\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n\nThis implementation silently and \"sanely\" tolerates continuation line\nscenarios for which behavior is not defined by [1]. In particular, an\nindented line which is the first (non-comment) line in the file is\ntreated as a single logical line. Ditto for a line ending with '\\' which\nis the last (non-comment) line in the file.\n\nAn earlier iteration emitted warnings for such cases, but it wasn't\nclear if warning about undefined behavior was useful; and it made the\nimplementation much more noisy, so this version silently tolerates such\nanomalies.\n\n Documentation/git-send-email.txt |  2 --\n git-send-email.perl              | 10 +++++++---\n 2 files changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex e6d466e..7ae467b 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -394,8 +394,6 @@ described below:\n sendmail;;\n *\tQuoted aliases and quoted addresses are not supported: lines that\n \tcontain a `\"` symbol are ignored.\n-*\tLine continuations are not supported: lines that start with\n-\twhitespace characters, or end with a `\\` symbol are ignored.\n *\tRedirection to a file (`/path/name`) or pipe (`|command`) is not\n \tsupported.\n *\tFile inclusion (`:include: /path/name`) is not supported.\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex e777bd3..eb1d678 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -492,8 +492,6 @@ sub parse_sendmail_alias {\n \tlocal $_ = shift;\n \tif (/\"/) {\n \t\tprint STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n-\t} elsif (/^\\s|\\\\$/) {\n-\t\tprint STDERR \"warning: sendmail continuation line is not supported: $_\\n\";\n \t} elsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n \t\tmy ($alias, $addr) = ($1, $2);\n \t\t$aliases{$alias} = [ split_addrs($addr) ];\n@@ -504,10 +502,16 @@ sub parse_sendmail_alias {\n \n sub parse_sendmail_aliases {\n \tmy $fh = shift;\n+\tmy $s = '';\n \twhile (<$fh>) {\n+\t\tchomp;\n \t\tnext if /^\\s*$/ || /^\\s*#/;\n-\t\tparse_sendmail_alias($_);\n+\t\t$s .= $_, next if $s =~ s/\\\\$// || s/^\\s+//;\n+\t\tparse_sendmail_alias($s) if $s;\n+\t\t$s = $_;\n \t}\n+\t$s =~ s/\\\\$//; # silently tolerate stray '\\' on last line\n+\tparse_sendmail_alias($s) if $s;\n }\n \n my %parse_alias = (\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262540","messageId":"1433111371-19573-9-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 8/9] t9001: refactor sendmail aliases test infrastructure","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:30Z","receivedAt":"2015-05-31T22:29:30Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Several new tests of sendmail aliases parsing will be added in a\nsubsequent patch, so factor out functionality common to all of them\ninto a new helper function.\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n t/t9001-send-email.sh | 47 +++++++++++++++++++++++++++++------------------\n 1 file changed, 29 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex a3663da..1012fa3 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1549,10 +1549,35 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '\n \tgrep \"^!someone@example\\.org!$\" commandline1\n '\n \n-test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' '\n-\tclean_fake_sendmail && rm -fr outdir &&\n-\tgit format-patch -1 -o outdir &&\n-\tcat >>.tmp-email-aliases <<-\\EOF &&\n+test_sendmail_aliases () {\n+\tmsg=\"$1\" && shift &&\n+\texpect=\"$@\" &&\n+\tcat >.tmp-email-aliases &&\n+\n+\ttest_expect_success $PREREQ \"$msg\" '\n+\t\tclean_fake_sendmail && rm -fr outdir &&\n+\t\tgit format-patch -1 -o outdir &&\n+\t\tgit config --replace-all sendemail.aliasesfile \\\n+\t\t\t\"$(pwd)/.tmp-email-aliases\" &&\n+\t\tgit config sendemail.aliasfiletype sendmail &&\n+\t\tgit send-email \\\n+\t\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t\t--to=alice --to=bcgrp \\\n+\t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\t\toutdir/0001-*.patch \\\n+\t\t\t2>errors >out &&\n+\t\tfor i in $expect\n+\t\tdo\n+\t\t\tgrep \"^!$i!$\" commandline1 || return 1\n+\t\tdone\n+\t'\n+}\n+\n+test_sendmail_aliases 'sendemail.aliasfiletype=sendmail' \\\n+\t'awol@example\\.com' \\\n+\t'bob@example\\.com' \\\n+\t'chloe@example\\.com' \\\n+\t'o@example\\.com' <<-\\EOF\n \talice: Alice W Land <awol@example.com>\n \tbob: Robert Bobbyton <bob@example.com>\n \t# this is a comment\n@@ -1561,20 +1586,6 @@ test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' '\n \tabgroup: alice, bob\n \tbcgrp: bob, chloe, Other <o@example.com>\n \tEOF\n-\tgit config --replace-all sendemail.aliasesfile \\\n-\t\t\"$(pwd)/.tmp-email-aliases\" &&\n-\tgit config sendemail.aliasfiletype sendmail &&\n-\tgit send-email \\\n-\t\t--from=\"Example <nobody@example.com>\" \\\n-\t\t--to=alice --to=bcgrp \\\n-\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n-\t\toutdir/0001-*.patch \\\n-\t\t2>errors >out &&\n-\tgrep \"^!awol@example\\.com!$\" commandline1 &&\n-\tgrep \"^!bob@example\\.com!$\" commandline1 &&\n-\tgrep \"^!chloe@example\\.com!$\" commandline1 &&\n-\tgrep \"^!o@example\\.com!$\" commandline1\n-'\n \n do_xmailer_test () {\n \texpected=$1 params=$2 &&\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262545","messageId":"1433111371-19573-10-git-send-email-sunshine@sunshineco.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH 9/9] t9001: add sendmail aliases line continuation tests","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-31T22:29:31Z","receivedAt":"2015-05-31T22:29:31Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"A line beginning with whitespace is folded into the preceding line.\nA line ending with '\\' consumes the following line.\n\nWhile here, also test an empty sendmail aliases file.\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n t/t9001-send-email.sh | 34 ++++++++++++++++++++++++++++++++++\n 1 file changed, 34 insertions(+)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 1012fa3..db2f45e 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1587,6 +1587,40 @@ test_sendmail_aliases 'sendemail.aliasfiletype=sendmail' \\\n \tbcgrp: bob, chloe, Other <o@example.com>\n \tEOF\n \n+test_sendmail_aliases 'sendmail aliases line folding' \\\n+\talice1 \\\n+\tbob1 bob2 \\\n+\tchuck1 chuck2 \\\n+\tdarla1 darla2 darla3 \\\n+\telton1 elton2 elton3 \\\n+\tfred1 fred2 \\\n+\tgreg1 <<-\\EOF\n+\talice: alice1\n+\tbob: bob1,\\\n+\tbob2\n+\tchuck: chuck1,\n+\t    chuck2\n+\tdarla: darla1,\\\n+\tdarla2,\n+\t    darla3\n+\telton: elton1,\n+\t    elton2,\\\n+\telton3\n+\tfred: fred1,\\\n+\t    fred2\n+\tgreg: greg1\n+\tbcgrp: bob, chuck, darla, elton, fred, greg\n+\tEOF\n+\n+test_sendmail_aliases 'sendmail aliases tolerate bogus line folding' \\\n+\talice1 bob1 <<-\\EOF\n+\t    alice: alice1\n+\tbcgrp: bob1\\\n+\tEOF\n+\n+test_sendmail_aliases 'sendmail aliases empty' alice bcgrp <<-\\EOF\n+\tEOF\n+\n do_xmailer_test () {\n \texpected=$1 params=$2 &&\n \tgit format-patch -1 &&\n-- \n2.4.2.538.g5f4350e\n"},{"id":"262555","messageId":"CAPig+cR=_3Bb4NOb=4uD8sokhU_n6=5nh3WdvTH5_yL_t_uung@mail.gmail.com","threadId":"39471","inReplyTo":"1433111371-19573-7-git-send-email-sunshine@sunshineco.com","subject":"Re: [PATCH 6/9] send-email: simplify sendmail aliases comment and blank line recognizer","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-06-01T03:30:41Z","receivedAt":"2015-06-01T03:30:41Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, May 31, 2015 at 6:29 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> Replace unnecessarily complex regular expression for recognizing comment\n> and blanks lines in sendmail aliases with idiomatic expressions which\n\ns/blanks/blank/\n\n> can be easily understood at a glance.\n>\n> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>\n> ---\n>  git-send-email.perl | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 76bb499..e777bd3 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -505,7 +505,7 @@ sub parse_sendmail_alias {\n>  sub parse_sendmail_aliases {\n>         my $fh = shift;\n>         while (<$fh>) {\n> -               if (/^\\s*(?:#.*)?$/) { next; }\n> +               next if /^\\s*$/ || /^\\s*#/;\n>                 parse_sendmail_alias($_);\n>         }\n>  }\n> --\n> 2.4.2.538.g5f4350e\n"},{"id":"262582","messageId":"CAJ80sau0GeeFxFZYsEE=uupfPqJ=vRZfNRuNd0qRJPDNvnbMPw@mail.gmail.com","threadId":"39471","inReplyTo":"1433111371-19573-2-git-send-email-sunshine@sunshineco.com","subject":"Re: [PATCH 1/9] send-email: further document missing sendmail aliases functionality","fromName":"Allen Hubbe","fromEmail":"allenbh@gmail.com","sentAt":"2015-06-01T11:43:08Z","receivedAt":"2015-06-01T11:43:08Z","isPatch":true,"sender":{"key":"allenbh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/812915?v=4"},"body":"According to the documentation, the parser should print a warning for\nany explicitly unsupported constructs.  These are now explicitly\nunsupported, so the parser should warn on |, /, and :include: .\nPerhaps the lines that match should be ignored like the others, too.\n\nOn Sun, May 31, 2015 at 6:29 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> Sendmail aliases[1] supports expansion to a file (\"/path/name\") or\n> pipe (\"|command\"), as well as file inclusion (\":include: /path/name\"),\n> however, our implementation does not support such functionality.\n>\n> [1]: https://www.freebsd.org/cgi/man.cgi?query=aliases&sektion=5\n>\n> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>\n> ---\n>  Documentation/git-send-email.txt | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\n> index b48a764..e6d466e 100644\n> --- a/Documentation/git-send-email.txt\n> +++ b/Documentation/git-send-email.txt\n> @@ -396,6 +396,9 @@ sendmail;;\n>         contain a `\"` symbol are ignored.\n>  *      Line continuations are not supported: lines that start with\n>         whitespace characters, or end with a `\\` symbol are ignored.\n> +*      Redirection to a file (`/path/name`) or pipe (`|command`) is not\n> +       supported.\n> +*      File inclusion (`:include: /path/name`) is not supported.\n>  *      Warnings are printed on the standard error output for any\n>         explicitly unsupported constructs, and any other lines that are not\n>         recognized by the parser.\n> --\n> 2.4.2.538.g5f4350e\n>\n"},{"id":"262584","messageId":"CAJ80saufd9xMAdvBT6Ts0RyVWW+PimTwvgojZ9bCT26vgUF-7g@mail.gmail.com","threadId":"39471","inReplyTo":"1433111371-19573-1-git-send-email-sunshine@sunshineco.com","subject":"Re: [PATCH 0/9] send-email: add sendmail aliases line continuation support","fromName":"Allen Hubbe","fromEmail":"allenbh@gmail.com","sentAt":"2015-06-01T11:49:36Z","receivedAt":"2015-06-01T11:49:36Z","isPatch":true,"sender":{"key":"allenbh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/812915?v=4"},"body":"This series looks very good to me.  Thanks for the extra work you've\ndone to make the sendmail alias support much better :)\n\nI'm not too concerned about this, but if you think it would be\nappropriate you may use it:\nAcked-by: Allen Hubbe <allenbh@gmail.com>\n\nOn Sun, May 31, 2015 at 6:29 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> This series adds line continuation support for sendmail aliases.\n> It extends basic sendmail aliases functionality implemented by\n> ah/send-email-sendmail-alias (currently d1205b07 in 'pu')\n>\n> Eric Sunshine (9):\n>   send-email: further document missing sendmail aliases functionality\n>   send-email: visually distinguish sendmail aliases parser warnings\n>   send-email: drop noise comments which merely repeat what code says\n>   send-email: fix style: cuddle 'elsif' and 'else' with closing brace\n>   send-email: refactor sendmail aliases parser\n>   send-email: simplify sendmail aliases comment and blank line\n>     recognizer\n>   send-email: implement sendmail aliases line continuation support\n>   t9001: refactor sendmail aliases test infrastructure\n>   t9001: add sendmail aliases line continuation tests\n>\n>  Documentation/git-send-email.txt |  5 ++-\n>  git-send-email.perl              | 54 ++++++++++++++-------------\n>  t/t9001-send-email.sh            | 81 +++++++++++++++++++++++++++++++---------\n>  3 files changed, 94 insertions(+), 46 deletions(-)\n>\n> --\n> 2.4.2.538.g5f4350e\n>\n"},{"id":"262633","messageId":"20150601182236.GA28030@flurp.local","threadId":"39471","inReplyTo":"CAJ80sau0GeeFxFZYsEE=uupfPqJ=vRZfNRuNd0qRJPDNvnbMPw@mail.gmail.com","subject":"Re: [PATCH 1/9] send-email: further document missing sendmail aliases functionality","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-06-01T18:22:36Z","receivedAt":"2015-06-01T18:22:36Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, Jun 01, 2015 at 07:43:08AM -0400, Allen Hubbe wrote:\n> On May 31, 2015 at 6:29 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> > Sendmail aliases[1] supports expansion to a file (\"/path/name\") or\n> > pipe (\"|command\"), as well as file inclusion (\":include: /path/name\"),\n> > however, our implementation does not support such functionality.\n>\n> According to the documentation, the parser should print a warning for\n> any explicitly unsupported constructs.  These are now explicitly\n> unsupported, so the parser should warn on |, /, and :include: .\n> Perhaps the lines that match should be ignored like the others, too.\n\nIndeed. I had that in mind and then promptly forgot about it. Here's a\nfollow-on patch:\n\n--- >8 ---\nFrom: Eric Sunshine <sunshine@sunshineco.com>\nSubject: [PATCH 10/9] send-email: further warn about unsupported sendmail aliases features\n\nThe sendmail aliases parser diagnoses unsupported features and\nunrecognized lines. For completeness, also warn about unsupported\nredirection to \"/path/name\" and \"|command\", as well as \":include:\".\n\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n git-send-email.perl | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex eb1d678..ae9f869 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -492,6 +492,10 @@ sub parse_sendmail_alias {\n \tlocal $_ = shift;\n \tif (/\"/) {\n \t\tprint STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n+\t} elsif (/:include:/) {\n+\t\tprint STDERR \"warning: `:include:` not supported: $_\\n\";\n+\t} elsif (/[\\/|]/) {\n+\t\tprint STDERR \"warning: `/file` or `|pipe` redirection not supported: $_\\n\";\n \t} elsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n \t\tmy ($alias, $addr) = ($1, $2);\n \t\t$aliases{$alias} = [ split_addrs($addr) ];\n-- \n2.4.2.538.g5f4350e\n\n--- >8 ---\n"},{"id":"262657","messageId":"CAJ80sasfCfN7e6bi7nHjLet=DWMN8kyJxMyvqu-7psFqJ0k+pA@mail.gmail.com","threadId":"39471","inReplyTo":"20150601182236.GA28030@flurp.local","subject":"Re: [PATCH 1/9] send-email: further document missing sendmail aliases functionality","fromName":"Allen Hubbe","fromEmail":"allenbh@gmail.com","sentAt":"2015-06-01T22:44:49Z","receivedAt":"2015-06-01T22:44:49Z","isPatch":true,"sender":{"key":"allenbh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/812915?v=4"},"body":"This looks good.\n\nOn Mon, Jun 1, 2015 at 2:22 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Mon, Jun 01, 2015 at 07:43:08AM -0400, Allen Hubbe wrote:\n>> On May 31, 2015 at 6:29 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n>> > Sendmail aliases[1] supports expansion to a file (\"/path/name\") or\n>> > pipe (\"|command\"), as well as file inclusion (\":include: /path/name\"),\n>> > however, our implementation does not support such functionality.\n>>\n>> According to the documentation, the parser should print a warning for\n>> any explicitly unsupported constructs.  These are now explicitly\n>> unsupported, so the parser should warn on |, /, and :include: .\n>> Perhaps the lines that match should be ignored like the others, too.\n>\n> Indeed. I had that in mind and then promptly forgot about it. Here's a\n> follow-on patch:\n>\n> --- >8 ---\n> From: Eric Sunshine <sunshine@sunshineco.com>\n> Subject: [PATCH 10/9] send-email: further warn about unsupported sendmail aliases features\n>\n> The sendmail aliases parser diagnoses unsupported features and\n> unrecognized lines. For completeness, also warn about unsupported\n> redirection to \"/path/name\" and \"|command\", as well as \":include:\".\n>\n> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>\n> ---\n>  git-send-email.perl | 4 ++++\n>  1 file changed, 4 insertions(+)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index eb1d678..ae9f869 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -492,6 +492,10 @@ sub parse_sendmail_alias {\n>         local $_ = shift;\n>         if (/\"/) {\n>                 print STDERR \"warning: sendmail alias with quotes is not supported: $_\\n\";\n> +       } elsif (/:include:/) {\n> +               print STDERR \"warning: `:include:` not supported: $_\\n\";\n> +       } elsif (/[\\/|]/) {\n> +               print STDERR \"warning: `/file` or `|pipe` redirection not supported: $_\\n\";\n>         } elsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n>                 my ($alias, $addr) = ($1, $2);\n>                 $aliases{$alias} = [ split_addrs($addr) ];\n> --\n> 2.4.2.538.g5f4350e\n>\n> --- >8 ---\n"}]}