git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* t0005 failing with ksh93 on linux
@ 2010-07-09  3:08 Jonathan Nieder
  2010-07-09  7:05 ` [PATCH] t0005: work around strange $? in ksh when program terminated by a signal Johannes Sixt
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Nieder @ 2010-07-09  3:08 UTC (permalink / raw)
  To: git; +Cc: Jeff King

Hi,

I can’t seem to get test-sigchain to run with ksh93 on linux:

 $ ksh
 
 ksh>$ ../bin-wrappers/test-sigchain 
 three
 two
 one
 Terminated
 ksh>$ echo $?
 271
 ksh>$ exit
 $ ../bin-wrappers/test-sigchain 
 three
 two
 one
 Terminated
 $ echo $?
 143

As a result, t0005-signals.sh fails when run through that
shell.  Ideas?

$ ksh t0005-signals.sh  -v
Initialized empty Git repository in /dev/shm/alt-git/t/trash directory.t0005-signals/.git/
expecting success: 
[...]
        test_cmp expect actual

not ok - 1 sigchain works
[...]
$ git describe
v1.7.2-rc2
$ ksh --version
  version         sh (AT&T Research) 93s+ 2008-01-31
$ uname -s -r -m
Linux 2.6.26-2-686-bigmem i686

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] t0005: work around strange $? in ksh when program terminated by a signal
  2010-07-09  3:08 t0005 failing with ksh93 on linux Jonathan Nieder
@ 2010-07-09  7:05 ` Johannes Sixt
  2010-07-09 11:53   ` Jeff King
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Johannes Sixt @ 2010-07-09  7:05 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Jeff King

From: Johannes Sixt <j6t@kdbg.org>

ksh is known to report $? of programs that terminated by a signal as
256 + signal number instead of 128 + signal number like other POSIX
compliant shells. (ksh's behavior is still POSIX compliant in this regard.)

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
Am 7/9/2010 5:08, schrieb Jonathan Nieder:
> I can’t seem to get test-sigchain to run with ksh93 on linux:
> 
>  $ ksh
>  
>  ksh>$ ../bin-wrappers/test-sigchain 
>  three
>  two
>  one
>  Terminated
>  ksh>$ echo $?
>  271

ksh is not wrong, just strange. See http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02 (last sentence).

 -- Hannes

 t/t0005-signals.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index 09f855a..93e58c0 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -13,6 +13,7 @@ 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
 	  *) false ;;
 	esac &&
-- 
1.7.1.585.gf3448

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] t0005: work around strange $? in ksh when program terminated by a signal
  2010-07-09  7:05 ` [PATCH] t0005: work around strange $? in ksh when program terminated by a signal Johannes Sixt
@ 2010-07-09 11:53   ` Jeff King
  2010-07-09 14:39   ` Jonathan Nieder
  2010-07-09 15:45   ` Brandon Casey
  2 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2010-07-09 11:53 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Jonathan Nieder, git

On Fri, Jul 09, 2010 at 09:05:16AM +0200, Johannes Sixt wrote:

> From: Johannes Sixt <j6t@kdbg.org>
> 
> ksh is known to report $? of programs that terminated by a signal as
> 256 + signal number instead of 128 + signal number like other POSIX
> compliant shells. (ksh's behavior is still POSIX compliant in this regard.)

Thanks, that fix looks good to me.

Acked-by: Jeff King <peff@peff.net>

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] t0005: work around strange $? in ksh when program terminated by a signal
  2010-07-09  7:05 ` [PATCH] t0005: work around strange $? in ksh when program terminated by a signal Johannes Sixt
  2010-07-09 11:53   ` Jeff King
@ 2010-07-09 14:39   ` Jonathan Nieder
  2010-07-09 15:45   ` Brandon Casey
  2 siblings, 0 replies; 9+ messages in thread
From: Jonathan Nieder @ 2010-07-09 14:39 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, Jeff King

Johannes Sixt wrote:

> ksh is known to report $? of programs that terminated by a signal as
> 256 + signal number instead of 128 + signal number like other POSIX
> compliant shells. (ksh's behavior is still POSIX compliant in this regard.)

This patch works for me.

 $ ksh t0005-signals.sh
 *   ok 1: sigchain works
 * passed all 1 test(s)

Thanks for the explanation.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] t0005: work around strange $? in ksh when program terminated by a signal
  2010-07-09  7:05 ` [PATCH] t0005: work around strange $? in ksh when program terminated by a signal Johannes Sixt
  2010-07-09 11:53   ` Jeff King
  2010-07-09 14:39   ` Jonathan Nieder
@ 2010-07-09 15:45   ` Brandon Casey
  2010-07-09 16:03     ` Ævar Arnfjörð Bjarmason
  2010-07-12  6:41     ` [PATCH v2] t0005: work around strange $? in ksh93 " Johannes Sixt
  2 siblings, 2 replies; 9+ messages in thread
From: Brandon Casey @ 2010-07-09 15:45 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Jonathan Nieder, git, Jeff King

On 07/09/2010 02:05 AM, Johannes Sixt wrote:
> From: Johannes Sixt <j6t@kdbg.org>
> 
> ksh is known to report $? of programs that terminated by a signal as
> 256 + signal number instead of 128 + signal number like other POSIX
> compliant shells. (ksh's behavior is still POSIX compliant in this regard.)

This may only be true for Ksh93.  The Ksh88 man page says that
the exit status is 128+signum.  The Public domain Korn shell, and
ksh on IRIX 6.5, Solaris 7, 9, and 10 all exit with the standard
behavior of 128+signum.  So, it may be appropriate to change the
commit message and comment in t0005 to reflect this fact.

-Brandon


>  t/t0005-signals.sh |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
> index 09f855a..93e58c0 100755
> --- a/t/t0005-signals.sh
> +++ b/t/t0005-signals.sh
> @@ -13,6 +13,7 @@ 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
>  	  *) false ;;
>  	esac &&

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] t0005: work around strange $? in ksh when program  terminated by a signal
  2010-07-09 15:45   ` Brandon Casey
@ 2010-07-09 16:03     ` Ævar Arnfjörð Bjarmason
  2010-07-09 16:07       ` Brandon Casey
  2010-07-12  6:41     ` [PATCH v2] t0005: work around strange $? in ksh93 " Johannes Sixt
  1 sibling, 1 reply; 9+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-07-09 16:03 UTC (permalink / raw)
  To: Brandon Casey; +Cc: Johannes Sixt, Jonathan Nieder, git, Jeff King

On Fri, Jul 9, 2010 at 15:45, Brandon Casey
<brandon.casey.ctr@nrlssc.navy.mil> wrote:
> the exit status is 128+signum.  The Public domain Korn shell, and
> ksh on IRIX 6.5, Solaris 7, 9, and 10 all exit with the standard
> behavior of 128+signum.  So, it may be appropriate to change the
> commit message and comment in t0005 to reflect this fact.

s/standard/conventional/, no?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] t0005: work around strange $? in ksh when program  terminated by a signal
  2010-07-09 16:03     ` Ævar Arnfjörð Bjarmason
@ 2010-07-09 16:07       ` Brandon Casey
  0 siblings, 0 replies; 9+ messages in thread
From: Brandon Casey @ 2010-07-09 16:07 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Johannes Sixt, Jonathan Nieder, git, Jeff King

On 07/09/2010 11:03 AM, Ævar Arnfjörð Bjarmason wrote:
> On Fri, Jul 9, 2010 at 15:45, Brandon Casey
> <brandon.casey.ctr@nrlssc.navy.mil> wrote:
>> the exit status is 128+signum.  The Public domain Korn shell, and
>> ksh on IRIX 6.5, Solaris 7, 9, and 10 all exit with the standard
>> behavior of 128+signum.  So, it may be appropriate to change the
>> commit message and comment in t0005 to reflect this fact.
> 
> s/standard/conventional/, no?

sure.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] t0005: work around strange $? in ksh93 when program terminated by a signal
  2010-07-09 15:45   ` Brandon Casey
  2010-07-09 16:03     ` Ævar Arnfjörð Bjarmason
@ 2010-07-12  6:41     ` Johannes Sixt
  2010-07-12  6:47       ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Johannes Sixt @ 2010-07-12  6:41 UTC (permalink / raw)
  To: Brandon Casey; +Cc: Jonathan Nieder, git, Jeff King, Junio C Hamano

From: Johannes Sixt <j6t@kdbg.org>

ksh93 is known to report $? of programs that terminated by a signal as
256 + signal number instead of 128 + signal number like other POSIX
compliant shells. (ksh's behavior is still POSIX compliant in this regard.)

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jeff King <peff@peff.net>
---
Am 7/9/2010 17:45, schrieb Brandon Casey:
> This may only be true for Ksh93.  The Ksh88 man page says that
> the exit status is 128+signum.  The Public domain Korn shell, and
> ksh on IRIX 6.5, Solaris 7, 9, and 10 all exit with the standard
> behavior of 128+signum.

Thanks for you input!

Hannes

 t/t0005-signals.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index 09f855a..e17c96a 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -13,6 +13,7 @@ test_expect_success 'sigchain works' '
 	test-sigchain >actual
 	case "$?" in
 	143) true ;; # POSIX w/ SIGTERM=15
+	271) true ;; # ksh93 w/ SIGTERM=15
 	  3) true ;; # Windows
 	  *) false ;;
 	esac &&
-- 
1.7.1.585.gf3448

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] t0005: work around strange $? in ksh93 when program terminated by a signal
  2010-07-12  6:41     ` [PATCH v2] t0005: work around strange $? in ksh93 " Johannes Sixt
@ 2010-07-12  6:47       ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2010-07-12  6:47 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Brandon Casey, Jonathan Nieder, git, Jeff King, Junio C Hamano

Thanks; I've queued this last week already but have been busy this weekend
and haven't managed to push anything out.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-07-12  6:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-09  3:08 t0005 failing with ksh93 on linux Jonathan Nieder
2010-07-09  7:05 ` [PATCH] t0005: work around strange $? in ksh when program terminated by a signal Johannes Sixt
2010-07-09 11:53   ` Jeff King
2010-07-09 14:39   ` Jonathan Nieder
2010-07-09 15:45   ` Brandon Casey
2010-07-09 16:03     ` Ævar Arnfjörð Bjarmason
2010-07-09 16:07       ` Brandon Casey
2010-07-12  6:41     ` [PATCH v2] t0005: work around strange $? in ksh93 " Johannes Sixt
2010-07-12  6:47       ` Junio C Hamano

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).