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

Re: Scripted clone generating an incomplete, unusable .git/config

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 12, 2010, 02:16 UTC
Message-ID
<20101112021602.GA10765@burratino>
In-Reply-To
<20101111190508.GA3038@sigill.intra.peff.net>
Jeff King wrote:
> I don't think your patch is the right solution, but FWIW, sigchain was
> explicitly intended to be able to take SIG_DFL and SIG_IGN. Probably
> sigchain_fun should be removed and we should just use sighandler_t
> explicitly
Sorry, that was lazy of me.  The name sighandler_t is a GNU extension[1].

The following addresses my confusion but I doubt it's worth the syntactic ugliness.

-- 8< --
Subject: sigchain: hide sigchain_fun type

Signal handlers that might be passed to signal() must be pointers to function with the prototype

	void handler(int signum);

In glibc this type is called sighandler_t; in the sigchain lib, sigchain_fun.

These really represent the same type in all respects: even special values like SIG_IGN and SIG_DFL are perfectly reasonable arguments for a function accepting values of one of the two types. Avoid confusion by eliminating the sigchain_fun name from sigchain.h.

It would be nice to instead use sighandler_t everywhere, but unfortunately that name is a GNU extension.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 [1] http://www.delorie.com/gnu/docs/glibc/libc_481.html
 sigchain.c |    2 ++
 sigchain.h |    6 ++----
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sigchain.h b/sigchain.h
index 618083b..571d148 100644
--- a/sigchain.h
+++ b/sigchain.h
@@ -1,11 +1,9 @@
 #ifndef SIGCHAIN_H
 #define SIGCHAIN_H
 
-typedef void (*sigchain_fun)(int);
-
-int sigchain_push(int sig, sigchain_fun f);
+int sigchain_push(int sig, void (*f)(int));
 int sigchain_pop(int sig);
 
-void sigchain_push_common(sigchain_fun f);
+void sigchain_push_common(void (*f)(int));
 
 #endif /* SIGCHAIN_H */
diff --git a/sigchain.c b/sigchain.c
index 1118b99..f837f61 100644
--- a/sigchain.c
+++ b/sigchain.c
@@ -3,6 +3,8 @@
 
 #define SIGCHAIN_MAX_SIGNALS 32
 
+typedef void (*sigchain_fun)(int);
+
 struct sigchain_signal {
 	sigchain_fun *old;
 	int n;
Previous: Jeff KingNext: Jeff King
Message 10 of 17 in “Scripted clone generating an incomplete, unusable .git/config”
  1. Dun PealNov 10, 2010
  2. Stefan NaeweNov 11, 2010
  3. Stefan NaeweNov 11, 2010
  4. Jonathan NiederNov 11, 2010
  5. Nguyen Thai Ngoc DuyNov 11, 2010
  6. Jonathan NiederNov 11, 2010
  7. Daniel BarkalowNov 11, 2010
  8. Jonathan NiederNov 11, 2010
  9. Jeff KingNov 11, 2010
  10. Jonathan NiederNov 12, 2010
  11. Jeff KingNov 12, 2010
  12. Jonathan NiederNov 12, 2010
  13. Jonathan NiederNov 12, 2010
  14. Jeff KingNov 12, 2010
  15. Jonathan NiederNov 12, 2010
  16. daemon, tag, verify-tag: do not pass ignored signals to child (Re: Scripted clone generating an incomplete, unusable .git/config)Jonathan Nieder, Nov 12, 2010
  17. Andreas SchwabNov 11, 2010

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.