{"thread":{"id":"10008","subject":"[PATCH] Do not over-quote the -f envelopesender value.","startedAt":"2007-09-25T06:48:59Z","lastAt":"2007-09-25T06:48:59Z","messageCount":1,"participants":["Jim Meyering"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"53969","messageId":"871wcntf38.fsf@rho.meyering.net","threadId":"10008","inReplyTo":null,"subject":"[PATCH] Do not over-quote the -f envelopesender value.","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2007-09-25T06:48:59Z","receivedAt":"2007-09-25T06:48:59Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"\nWithout this, the value passed to sendmail would have an extra set of\nsingle quotes.  At least exim's sendmail emulation would object to that:\n\n    exim: bad -f address \"'list-addr@example.org'\": malformed address: ' \\\n      may not follow 'list-addr@example.org\n    error: hooks/post-receive exited with error code 1\n\nSigned-off-by: Jim Meyering <jim@meyering.net>\n---\n contrib/hooks/post-receive-email |   16 ++++++++++------\n 1 files changed, 10 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\nindex c589a39..1f88099 100644\n--- a/contrib/hooks/post-receive-email\n+++ b/contrib/hooks/post-receive-email\n@@ -571,6 +571,15 @@ generate_delete_general_email()\n \techo $LOGEND\n }\n\n+send_mail()\n+{\n+\tif [ -n \"$envelopesender\" ]; then\n+\t\t/usr/sbin/sendmail -t -f \"$envelopesender\"\n+\telse\n+\t\t/usr/sbin/sendmail -t\n+\tfi\n+}\n+\n # ---------------------------- main()\n\n # --- Constants\n@@ -607,13 +616,8 @@ if [ -n \"$1\" -a -n \"$2\" -a -n \"$3\" ]; then\n \t# resend an email; they could redirect the output to sendmail themselves\n \tPAGER= generate_email $2 $3 $1\n else\n-\tif [ -n \"$envelopesender\" ]; then\n-\t\tenvelopesender=\"-f '$envelopesender'\"\n-\tfi\n-\n \twhile read oldrev newrev refname\n \tdo\n-\t\tgenerate_email $oldrev $newrev $refname |\n-\t\t/usr/sbin/sendmail -t $envelopesender\n+\t\tgenerate_email $oldrev $newrev $refname | send_mail\n \tdone\n fi\n--\n1.5.3.2.99.ge4b2-dirty\n"}]}