Re: [PATCH] test-lib.sh: work around ksh's trap shortcomings
- From
Mike Ralphson <mike.ralphson@gmail.com>
- Date
- Aug 20, 2008, 11:36 UTC
- Message-ID
- <e2b179460808200436p1c35da29h5e895f44346df80d@mail.gmail.com>
- In-Reply-To
- <nEEUmh6BVMDYtwf1vENCYuaLiFUWKW_dbgPP__ECl3s@cipher.nrlssc.navy.mil>
2008/8/20 Brandon Casey <casey@nrlssc.navy.mil>
Show 17 quoted lines
> > Brandon Casey wrote: > > Junio C Hamano wrote: > >> Your alias test_done that calls function test_done look ugly and confusing > >> beyond words. Perhaps test_done() can instead set a global variable and > >> die() can notice it instead, like this? I haven't bothered to change the > >> other "trap - exit" but I think you got the idea... > > > > Yes that works and is much clearer. Tested on solaris and irix. > > I spoke too soon. Failing tests do not terminate the testing. > > ksh does not place the exit status of the shell in $? or provide it as an argument > to the trap function. ... it looks like the status of the command executed immediately before > exit is what the trap has access to in $?. Adding a call to false before exit > in the above script causes the korn scripts to exit with status 1 on IRIX and > SunOS.
Just to report the same findings with AIX 5.3's /bin/sh (which is /bin/ksh), /bin/ksh93 and even /bin/bsh
Mike