git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Do not over-quote the -f envelopesender value.

From
Jim Meyering <jim@meyering.net>
Date
Sep 25, 2007, 06:48 UTC
Message-ID
<871wcntf38.fsf@rho.meyering.net>

Without this, the value passed to sendmail would have an extra set of single quotes. At least exim's sendmail emulation would object to that:

    exim: bad -f address "'list-addr@example.org'": malformed address: ' \
      may not follow 'list-addr@example.org
    error: hooks/post-receive exited with error code 1
Signed-off-by: Jim Meyering <jim@meyering.net>
---
 contrib/hooks/post-receive-email |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index c589a39..1f88099 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -571,6 +571,15 @@ generate_delete_general_email()
 	echo $LOGEND
 }

+send_mail()
+{
+	if [ -n "$envelopesender" ]; then
+		/usr/sbin/sendmail -t -f "$envelopesender"
+	else
+		/usr/sbin/sendmail -t
+	fi
+}
+
 # ---------------------------- main()

 # --- Constants
@@ -607,13 +616,8 @@ if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
 	# resend an email; they could redirect the output to sendmail themselves
 	PAGER= generate_email $2 $3 $1
 else
-	if [ -n "$envelopesender" ]; then
-		envelopesender="-f '$envelopesender'"
-	fi
-
 	while read oldrev newrev refname
 	do
-		generate_email $oldrev $newrev $refname |
-		/usr/sbin/sendmail -t $envelopesender
+		generate_email $oldrev $newrev $refname | send_mail
 	done
 fi
--
1.5.3.2.99.ge4b2-dirty
Message 1 of 1 in “Do not over-quote the -f envelopesender value.”
  1. Do not over-quote the -f envelopesender value.Jim Meyering, Sep 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.