mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Replace safe FD fix with Solaris/ksh2020 version (re: 045fe6a1
)
This pulls a new version of sh_iosafefd() from: https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/285-30771135.patch It was written by Kurtis Rader for ksh2020: https://github.com/att/ast/issues/198 https://github.com/att/ast/pull/199 It is presumably better than the Red Hat version and also comes with more regression test cases (although it still doesn't fix modernish BUG_CSUBSTDO, which remains in the TODO file). This commit does not go along with other peripheral changes from that patch, i.e. a different name and location of this function. src/cmd/ksh93/sh/io.c: - Replace sh_iosafefd() as above. src/cmd/ksh93/tests/subshell.sh: - Add and tweak tests from the patch.
This commit is contained in:
parent
17ebfbf6a3
commit
ab98ec65e4
2 changed files with 39 additions and 7 deletions
|
@ -854,6 +854,32 @@ actual=${ get_value; }
|
|||
actual=`get_value`
|
||||
[[ $actual == "$expect" ]] || err_exit "\`Comsub\` failed to return output (expected '$expect', got '$actual')"
|
||||
|
||||
# more tests from https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/285-30771135.patch
|
||||
tmpfile=$tmp/1116072.dummy
|
||||
touch "$tmpfile"
|
||||
exp='return value'
|
||||
function get_value
|
||||
{
|
||||
case=$1
|
||||
(( case >= 1 )) && exec 3< $tmpfile
|
||||
(( case >= 2 )) && exec 4< $tmpfile
|
||||
(( case >= 3 )) && exec 6< $tmpfile
|
||||
# To trigger the bug we have to spawn an external command.
|
||||
$(whence -p true)
|
||||
(( case >= 1 )) && exec 3<&-
|
||||
(( case >= 2 )) && exec 4<&-
|
||||
(( case >= 3 )) && exec 6<&-
|
||||
print "$exp"
|
||||
}
|
||||
got=$(get_value 0)
|
||||
[[ $got == "$exp" ]] || err_exit "failed to capture subshell output when closing fd: case 0"
|
||||
got=$(get_value 1)
|
||||
[[ $got == "$exp" ]] || err_exit "failed to capture subshell output when closing fd: case 1"
|
||||
got=$(get_value 2)
|
||||
[[ $got == "$exp" ]] || err_exit "failed to capture subshell output when closing fd: case 2"
|
||||
got=$(get_value 3)
|
||||
[[ $got == "$exp" ]] || err_exit "failed to capture subshell output when closing fd: case 3"
|
||||
|
||||
# ======
|
||||
# https://bugzilla.redhat.com/1117404
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue