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/tests
Martijn Dekker a2196f9434 Fix backtick comsubs by making them act like $(modern) ones
ksh93 currently has three command substitution mechanisms:
- type 1: old-style backtick comsubs that use a pipe;
- type 3: $(modern) comsubs that use a temp file, currently with
  fallback to a pipe if a temp file cannot be created;
- type 2: ${ shared-state; } comsubs; same as type 3, but shares
  state with parent environment.

Type 1 is buggy. There are at least two reproducers that make it
hang. The Red Hat patch applied in 4ce486a7 fixed a hang in
backtick comsubs but reintroduced another hang that was fixed in
ksh 93v-. So far, no one has succeeded in making pipe-based comsubs
work properly.

But, modern (type 3) comsubs use temp files. How does it make any
sense to have two different command substitution mechanisms at the
execution level? The specified functionality between backtick and
modern command substitutions is exactly the same; the difference
*should* be purely syntactic.

So this commit removes the type 1 comsub code at the execution
level, treating them all like type 3 (or 2). As a result, the
related bugs vanish while the regression tests all pass.

The only side effect that I can find is that the behaviour of bug
https://github.com/ksh93/ksh/issues/124 changes for backtick
comsubs. But it's broken either way, so that's neutral.

So this commit can now be added to my growing list of ksh93 issues
fixed by simply removing code.

src/cmd/ksh93/sh/xec.c:
- Remove special code for type 1 comsubs from iousepipe(),
  sh_iounpipe(), sh_exec() and _sh_fork().

src/cmd/ksh93/include/defs.h,
src/cmd/ksh93/sh/subshell.c:
- Remove pipe support from sh_subtmpfile(). This also removes the
  use of a pipe as a fallback for $(modern) comsubs. Instead, panic
  and error out if temp file creation fails. If the shell cannot
  create a temporary file, there are fatal system problems anyway
  and a script should not continue.
- No longer pass comsub type to sh_subtmpfile().

All other changes:
- Update sh_subtmpfile() calls.

src/cmd/ksh93/tests/subshell.sh:
- Add two regression tests based on reproducers from bug reports.

Resolves: https://github.com/ksh93/ksh/issues/305
Resolves: https://github.com/ksh93/ksh/issues/316
2021-08-13 09:14:11 +02:00
..
_common Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
alias.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
append.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
arith.sh Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
arrays.sh Fix some bugs in the regression tests and add more regression tests (#295) 2021-05-03 06:52:27 +01:00
arrays2.sh Correct regression for compound arithmetic expressions (re: 642a1053) (#297) 2021-05-05 03:29:19 +01:00
attributes.sh Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
basic.sh Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
bracket.sh [[ ... ]]: fix '!' to negate another '!' 2021-06-03 15:57:16 +02:00
builtins.sh Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
case.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
comvar.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
comvario.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
coprocess.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
cubetype.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
enum.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
exit.sh Fix shell exit on function call redirection error (re: 23f2e23) 2021-05-19 06:59:18 +02:00
expand.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
functions.sh Fix some bugs in the regression tests and add more regression tests (#295) 2021-05-03 06:52:27 +01:00
glob.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
grep.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
heredoc.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
io.sh tests/io.sh: fix spurious failure on Gentoo i386 (re: c4f980eb) 2021-05-03 16:38:37 +01:00
jobs.sh ...and now make it work with shcomp (re: aed5c6d7) 2021-03-13 19:27:15 +00:00
leaks.sh Enable some memory leak tests for standard malloc (re: 05683ec7) (#311) 2021-05-21 01:52:32 +02:00
locale.sh tests/locale.sh: skip SJIS test on non-SJIS locale (re: c2cb0eae) 2021-05-11 21:07:33 +02:00
math.sh Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
nameref.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
namespace.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
options.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
path.sh Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
pointtype.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
pty.sh Re-fix 'test -t 1' in command substitutions (re: 090b65e7) 2021-05-14 04:52:18 +02:00
quoting.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
quoting2.sh Fix remaining bug in ${var:-'{}'} (re: d087b031) 2021-05-03 03:14:30 +01:00
readcsv.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
readonly.sh Adjust readonly regression tests for freezes (#267) 2021-04-11 19:57:40 +01:00
recttype.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
restricted.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
return.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
select.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
shtests Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
sigchld.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
signal.sh Fix xtrace (shtests -x) for the regression tests 2021-05-14 19:56:11 +02:00
statics.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
subshell.sh Fix backtick comsubs by making them act like $(modern) ones 2021-08-13 09:14:11 +02:00
substring.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
tilde.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
timetype.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
treemove.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
types.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
variables.sh Add regression test (re: e5e1d4b5) 2021-05-19 06:13:30 +02:00
vartree1.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
vartree2.sh Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00