1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/sh
Martijn Dekker 0dd115e4b4 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
2021-05-19 06:59:18 +02:00
..
args.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
arith.c Correct regression for compound arithmetic expressions (re: 642a1053) (#297) 2021-05-05 03:29:19 +01:00
array.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
defs.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
deparse.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
expand.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
fault.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
fcin.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
init.c Fix typeset -u/-l on NetBSD 2021-05-18 18:26:33 +02:00
io.c Fix fork after redirecting stdout in subshare (re: 500757d7) 2021-04-26 18:22:17 +01:00
jobs.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
lex.c Fix single quotes in expansion operator string (re: 5ed9ffd6) 2021-04-30 05:28:21 +01:00
macro.c Fix regression caused by ${var:-'{}'} fix (re: f31e3687) 2021-05-03 05:55:47 +01:00
main.c Fix $RANDOM to act consistently in subshells (#294) 2021-05-03 04:03:46 +01:00
name.c Improve fix for not exporting readonly attribute (re: 7954855f) 2021-05-13 05:12:31 +02:00
nvdisc.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
nvtree.c Fix more bugs that occur when enabling ASan (#293) 2021-05-02 04:06:30 +01:00
nvtype.c Fix more bugs that occur when enabling ASan (#293) 2021-05-02 04:06:30 +01:00
parse.c POSIX: 'command': don't disable declaration proprts (re: b9d10c5a) 2021-05-04 00:52:10 +01:00
path.c Fix two more 'command' bugs 2021-05-05 02:43:18 +01:00
pmain.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
shcomp.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
streval.c Fix arithmetic assignment operations for multidimensional indexed arrays (#296) 2021-05-04 03:13:14 +01:00
string.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
subshell.c Fix $RANDOM to act consistently in subshells (#294) 2021-05-03 04:03:46 +01:00
suid_exec.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
tdump.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
timers.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
trestore.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
waitevent.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
xec.c Fix shell exit on function call redirection error (re: 23f2e23) 2021-05-19 06:59:18 +02:00