git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v2 3/5] chain kill signals for cleanup functions
Date: Fri, 30 Jan 2009 02:55:52 -0500	[thread overview]
Message-ID: <20090130075552.GA27716@coredump.intra.peff.net> (raw)
In-Reply-To: <20090122060235.GC30133@coredump.intra.peff.net>

On Thu, Jan 22, 2009 at 01:02:35AM -0500, Jeff King wrote:

> diff --git a/test-sigchain.c b/test-sigchain.c
> new file mode 100644
> index 0000000..8747dea
> --- /dev/null
> +++ b/test-sigchain.c
> [...]
> +int main(int argc, char **argv) {
> +	sigchain_push(SIGINT, one);
> +	sigchain_push(SIGINT, two);
> +	sigchain_push(SIGINT, three);
> +	raise(SIGINT);
> +	return 0;
> +}

The signal-handling test was failing on my Solaris auto-build. After
much painful debugging, it seems that when running without a controlling
terminal (such as under cron), the signal handler for terminal related
signals (including SIGINT) is initialized to SIG_IGN. Thus after popping
all of our signal handlers, we restore the SIG_IGN, the program is _not_
killed by the signal, and the test fails.

One fix would be to just "signal(SIGINT, SIG_DFL)" at the top. But I
think it makes the test cleaner to just switch to a more reliable
signal. The patch would look something like what is below. But I need to
know what exit code Windows generates for SIGTERM. Johannes?

---
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index 9707af7..09f855a 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -12,7 +12,7 @@ EOF
 test_expect_success 'sigchain works' '
 	test-sigchain >actual
 	case "$?" in
-	130) true ;; # POSIX w/ SIGINT=2
+	143) true ;; # POSIX w/ SIGTERM=15
 	  3) true ;; # Windows
 	  *) false ;;
 	esac &&
diff --git a/test-sigchain.c b/test-sigchain.c
index 8747dea..42db234 100644
--- a/test-sigchain.c
+++ b/test-sigchain.c
@@ -14,9 +14,9 @@ X(three)
 #undef X
 
 int main(int argc, char **argv) {
-	sigchain_push(SIGINT, one);
-	sigchain_push(SIGINT, two);
-	sigchain_push(SIGINT, three);
-	raise(SIGINT);
+	sigchain_push(SIGTERM, one);
+	sigchain_push(SIGTERM, two);
+	sigchain_push(SIGTERM, three);
+	raise(SIGTERM);
 	return 0;
 }

  reply	other threads:[~2009-01-30  7:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-22  3:55 What's cooking in git.git (Jan 2009, #05; Wed, 21) Junio C Hamano
2009-01-22  4:26 ` Jeff King
2009-01-22  5:57   ` [PATCH v2 1/5] Windows: Fix signal numbers Jeff King
2009-01-22  5:59   ` [PATCH v2 2/5] diff: refactor tempfile cleanup handling Jeff King
2009-01-22  6:02   ` [PATCH v2 3/5] chain kill signals for cleanup functions Jeff King
2009-01-30  7:55     ` Jeff King [this message]
2009-01-30  8:13       ` Johannes Sixt
2009-01-30  8:21         ` Jeff King
2009-01-31  0:28           ` Junio C Hamano
2009-01-31  1:44             ` Jeff King
2009-01-31  6:50               ` Jeff King
2009-02-01  1:58                 ` Junio C Hamano
2009-01-22  6:03   ` [PATCH v2 4/5] refactor signal handling " Jeff King
2009-01-22  6:03   ` [PATCH v2 5/5] pager: do wait_for_pager on signal death Jeff King
2009-01-22  5:13 ` What's cooking in git.git (Jan 2009, #05; Wed, 21) Johannes Schindelin
2009-01-31  6:45   ` Sam Vilain
2009-01-31  7:36     ` Jeff King
2009-02-01  2:39       ` [PATCH] split notes [was: Re: What's cooking in git.git (Jan 2009, #05; Wed, 21)] Sam Vilain
2009-02-01  3:09       ` Sam Vilain
2009-02-01 12:01         ` Jakub Narebski
2009-01-22  5:21 ` What's cooking in git.git (Jan 2009, #05; Wed, 21) Boyd Stephen Smith Jr.
2009-01-23  6:23   ` Junio C Hamano
2009-01-27  1:43   ` Boyd Stephen Smith Jr.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090130075552.GA27716@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).