1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

regress: avoid backporting a cmd subst bug from beta

ksh 93v- beta introduced a regression with nested command
substitutions: backticks nested in $( ) result in misdirected
output. This has never been in 93u+, but since we're often
backporting things, let's avoid backporting this bug. It is also
useful if this shows up when running our bin/shtests against the
actual beta by adding a SHELL=... argument.
Ref.: https://github.com/att/ast/issues/478

src/cmd/ksh93/tests/subshell.sh:
- Add reproducer submitted by the reporter as a regression test.
This commit is contained in:
Martijn Dekker 2020-06-15 12:32:57 +02:00
parent 503a596a3e
commit 7f2c81103b

View file

@ -336,6 +336,17 @@ do for ((TEST=1; TEST<=${#testcase[@]}; TEST++))
shift 2
done
# Regression introduced in 93v- beta; let's make sure not to backport it to 93u+m
# Ref.: https://github.com/att/ast/issues/478
expected='foo=bar'
actual=$(
foo=$(print `/bin/echo bar`) # should print nothing
print foo=$foo # should print "foo=bar"
)
[[ $actual == "$expected" ]] \
|| err_exit 'Backticks nested in $( ) result in misdirected output' \
"(expected $(printf %q "$expect"), got $(printf $q "$actual"))"
# the next tests loop on all combinations of
# { SUB CAT INS TST APP } X { file-sizes }
# where the file size starts at 1Ki and doubles up to and including 1Mi