Leah Neukirchen <[email protected]> writes: >>Synopsis: ksh: failing eval stops execution even when in OR-list
I noticed this issue else appears only in pdksh, but not in mksh. Bisecting mksh I found this fixed between R21 and R22, in this commit: https://github.com/MirBSD/mksh/commit/ba859c9ab1d7bae5a70c0d094f5a39669e8f81ef This Debian bug report from 2004 shows that it also occured in other shells that fixed it since then: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=269067 Here's a patch that fixes it, but it's more an idea of what someone experienced with the code base could look for: --- a/c_sh.c +++ b/c_sh.c @@ -424,6 +424,8 @@ int c_eval(char **wp) { struct source *s; + struct source *saves = source; + int savef; int rv; if (ksh_getopt(wp, &builtin_opt, null) == '?') @@ -458,7 +460,11 @@ c_eval(char **wp) exstat = subst_exstat; } + savef = Flag(FERREXIT); + Flag(FERREXIT) = 0; rv = shell(s, false); + Flag(FERREXIT) = savef; + source = saves; afree(s, ATEMP); return (rv); } Cheers, -- Leah Neukirchen <[email protected]> https://leahneukirchen.org/
