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

[RFC PATCH 2/4] verify-tag.c: ignore SIGPIPE around gpg invocation

From
Deskin Miller <deskinm@umich.edu>
Date
Nov 24, 2008, 03:23 UTC
Message-ID
<1227497000-8684-3-git-send-email-deskinm@umich.edu>
In-Reply-To
<1227497000-8684-2-git-send-email-deskinm@umich.edu>

builtin-verify-tag.c already sets SIG_IGN for SIGPIPE before calling verify_tag, but new callers of verify_tag_sha1 may not have modified the signal handler, and shouldn't have to. Save and restore the signal handler for SIGPIPE around the invocation of gpg.

Signed-off-by: Deskin Miller <deskinm@umich.edu>
---
 verify-tag.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/verify-tag.c b/verify-tag.c
index c9be331..c3e35f3 100644
--- a/verify-tag.c
+++ b/verify-tag.c
@@ -7,6 +7,7 @@
 #include "cache.h"
 #include "object.h"
 #include "run-command.h"
+#include <signal.h>
 
 #define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
 
@@ -17,6 +18,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
 	char path[PATH_MAX], *eol;
 	size_t len;
 	int fd, ret;
+	sighandler_t save_handle;
 
 	fd = git_mkstemp(path, PATH_MAX, ".git_vtag_tmpXXXXXX");
 	if (fd < 0)
@@ -40,8 +42,10 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
 	gpg.argv = args_gpg;
 	gpg.in = -1;
 	args_gpg[2] = path;
+	save_handle = signal(SIGPIPE, SIG_IGN);
 	if (start_command(&gpg)) {
 		unlink(path);
+		signal(SIGPIPE, save_handle);
 		return error("could not run gpg.");
 	}
 
@@ -50,6 +54,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
 	ret = finish_command(&gpg);
 
 	unlink(path);
+	signal(SIGPIPE, save_handle);
 
 	return ret;
 }
-- 
1.6.0.4.770.ga8394
Previous: Deskin MillerNext: Deskin Miller
Message 3 of 16 in “Teach git fetch to verify signed tags automatically”
  1. 0/4 Teach git fetch to verify signed tags automaticallyDeskin Miller, Nov 24, 2008
  2. 1/4 Refactor builtin-verify-tag.cDeskin Miller, Nov 24, 2008
  3. 2/4 verify-tag.c: ignore SIGPIPE around gpg invocationDeskin Miller, Nov 24, 2008
  4. 3/4 verify-tag.c: suppress gpg output if askedDeskin Miller, Nov 24, 2008
  5. 4/4 Make git fetch verify signed tagsDeskin Miller, Nov 24, 2008
  6. Johannes SchindelinNov 24, 2008
  7. Deskin MillerNov 28, 2008
  8. Johannes SchindelinNov 24, 2008
  9. Deskin MillerNov 28, 2008
  10. Junio C HamanoNov 24, 2008
  11. Junio C HamanoNov 24, 2008
  12. Deskin MillerNov 28, 2008
  13. Johannes SchindelinNov 28, 2008
  14. Johannes SchindelinNov 24, 2008
  15. Deskin MillerNov 28, 2008
  16. Junio C HamanoNov 28, 2008

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.