mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix shell exit on function call redirection error (re: 23f2e23
)
This regression also exists on ksh 93v- and ksh2020, from which it
was backported.
Reproducer:
$ (fn() { true; }; fn >/dev/null/ne; true) 2>/dev/null; echo $?
1
Expected output: 0 (as on ksh 93u+).
FreeBSD sh and NetBSD sh are the only other known shells that share
this behaviour. POSIX currently allows both behaviours, but may
require the ksh 93u+ behaviour in future. In any case, this causes
an incompatibility with established ksh behaviour that could easily
break existing ksh scripts.
src/cmd/ksh93/sh/xec.c: sh_exec():
- Commit 23f2e23
introduced a check for jmpval > SH_JMPIO (5).
When a function call pushes context for a redirection, this is
done with the jmpval exit value of SH_JMPCMD (6). Change that to
SH_JMPIO to avoid triggering that check.
src/cmd/ksh93/tests/exit.sh:
- Add regression tests for exit behaviour on various kinds of
shell errors as listed in the POSIX standard, including an error
in a redirection of a function call.
Fixes: https://github.com/ksh93/ksh/issues/310
This commit is contained in:
parent
07eb2040e8
commit
0dd115e4b4
3 changed files with 56 additions and 1 deletions
3
NEWS
3
NEWS
|
@ -7,6 +7,9 @@ Any uppercase BUG_* names are modernish shell bug IDs.
|
|||
|
||||
- Fixed SHLVL so that replacing ksh by itself (exec ksh) will not increase it.
|
||||
|
||||
- Fixed a regression introduced on 2020-08-05 that caused a non-interactive
|
||||
shell to exit if an I/O redirection of a function call encountered an error.
|
||||
|
||||
2021-05-13:
|
||||
|
||||
- Fixed a bug with 'test -t 1' that was introduced on 2021-04-26:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue