Am 6/6/2013 19:40, schrieb Jeff King: > On Thu, Jun 06, 2013 at 10:21:47AM -0700, Junio C Hamano wrote: > >>> The particular deficiency is that when a signal is raise()d whose SIG_DFL >>> action will cause process death (SIGTERM in this case), the >>> implementation of raise() just calls exit(3). >> >> After a bit of web searching, it seems to me that this behaviour of >> raise() is in msvcrt, and compat/mingw.c::mingw_raise() just calls >> that. In other words, "the implementation of raise()" is at an even >> lower level than mingw/msys, and I would agree that it is a platform >> issue. > > Yeah, if it were mingw_raise responsible for this, I would suggest using > the POSIX shell "128+sig" instead. We could potentially check for > SIG_DFL[1] mingw_raise and intercept and exit there. I don't know if > that would create headaches or confusion for other msys programs, > though. I'd leave that up to the msysgit people to decide whether it is > worth the trouble. Even if we move the signal emulation closer to POSIX in the way that you suggested (if that were possible, I haven't checked), the emulation is still not complete, because we would have addressed only raise(). Therefore, personally I would like to delay the issue until there is a user (script) that depends on POSIXly exit codes. As far as t0005.2 is concerned, its the best to just concede that Windows does not have POSIX-like behavior as far as signals are concerned, and skip the test. We could also sweep the issue under the rug with the patch below, which works because SIGALRM does not exist in MSVCRT and is handled entirely by compat/mingw.c. But it goes into the wrong direction, IMO. diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh index ad9e604..68b6c3b 100755 --- a/t/t0005-signals.sh +++ b/t/t0005-signals.sh @@ -12,9 +12,8 @@ EOF test_expect_success 'sigchain works' ' test-sigchain >actual case "$?" in - 143) true ;; # POSIX w/ SIGTERM=15 - 271) true ;; # ksh w/ SIGTERM=15 - 3) true ;; # Windows + 142) true ;; # POSIX w/ SIGALRM=14 + 270) true ;; # ksh w/ SIGTERM=14 *) false ;; esac && test_cmp expect actual @@ -23,8 +22,8 @@ test_expect_success 'sigchain works' ' test_expect_success 'signals are propagated using shell convention' ' # we use exec here to avoid any sub-shell interpretation # of the exit code - git config alias.sigterm "!exec test-sigchain" && - test_expect_code 143 git sigterm + git config alias.sigalrm "!exec test-sigchain" && + test_expect_code 142 git sigalrm ' test_done diff --git a/test-sigchain.c b/test-sigchain.c index 42db234..0233a39 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(SIGTERM, one); - sigchain_push(SIGTERM, two); - sigchain_push(SIGTERM, three); - raise(SIGTERM); + sigchain_push(SIGALRM, one); + sigchain_push(SIGALRM, two); + sigchain_push(SIGALRM, three); + raise(SIGALRM); return 0; } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html