{"thread":{"id":"55663","subject":"[PATCH v2] git-send-email: use ! to indicate relative path to command","startedAt":"2021-05-11T19:01:09Z","lastAt":"2021-05-11T19:01:09Z","messageCount":1,"participants":["Gregory Anders"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"424176","messageId":"20210511190101.22128-1-greg@gpanders.com","threadId":"55663","inReplyTo":null,"subject":"[PATCH v2] git-send-email: use ! to indicate relative path to command","fromName":"Gregory Anders","fromEmail":"greg@gpanders.com","sentAt":"2021-05-11T19:01:01Z","receivedAt":"2021-05-11T19:01:09Z","isPatch":true,"sender":{"key":"greg@gpanders.com","avatar":"https://avatars.githubusercontent.com/u/8965202?v=4"},"body":"When the smtpServer config option is prefixed with a ! character, the\nvalue of the option should be interpreted as a command to look up on\nPATH.\n---\n\nFix the implementation to correctly find the absolute path for the given \ncommand, and report an error if the command is not found on PATH.\n\n git-send-email.perl | 19 ++++++++++++++++++-\n 1 file changed, 18 insertions(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 175da07d94..6d10901595 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1492,7 +1492,24 @@ sub send_message {\n \n \tif ($dry_run) {\n \t\t# We don't want to send the email.\n-\t} elsif (file_name_is_absolute($smtp_server)) {\n+\t} elsif (file_name_is_absolute($smtp_server) || $smtp_server =~ /^!/) {\n+\t\tif ($smtp_server =~ s/^!//) {\n+\t\t\tmy $smtp_command;\n+\t\t\tmy @progs = map {\"$_/$smtp_server\"} split /:/, $ENV{PATH};\n+\t\t\tforeach (@progs) {\n+\t\t\t\tif (-x $_) {\n+\t\t\t\t\t$smtp_command = $_;\n+\t\t\t\t\tlast;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tif (!defined $smtp_command) {\n+\t\t\t\tdie __(\"The command $smtp_server was not found on PATH.\")\n+\t\t\t}\n+\n+\t\t\t$smtp_server = $smtp_command;\n+\t\t}\n+\n \t\tmy $pid = open my $sm, '|-';\n \t\tdefined $pid or die $!;\n \t\tif (!$pid) {\n-- \n2.31.1.576.g55f6e1c2f1\n\n"}]}