mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
add missing function crash test (re: 6193c6a3
)
Of course I was wrong to say the bug had nothing to do with functions; traps in ksh functions are local, are handled the same way as traps that are local to virtual subshells, and had the same crashing bug. So this adds a test for that as well.
This commit is contained in:
parent
6193c6a3c5
commit
a5d38b1de7
2 changed files with 17 additions and 1 deletions
|
@ -1306,5 +1306,22 @@ actual=$(
|
||||||
[[ $actual == "$expect" ]] || err_exit "wrong exit status from function invoked by command substitution" \
|
[[ $actual == "$expect" ]] || err_exit "wrong exit status from function invoked by command substitution" \
|
||||||
"(expected $(printf %q "$expect"), got $(printf %q "$actual"))"
|
"(expected $(printf %q "$expect"), got $(printf %q "$actual"))"
|
||||||
|
|
||||||
|
# ======
|
||||||
|
# https://bugzilla.redhat.com/1117404
|
||||||
|
|
||||||
|
cat >$tmp/crash_rhbz1117404.ksh <<-'EOF'
|
||||||
|
trap "" HUP # trigger part 1: signal ignored in main shell
|
||||||
|
function ksh_fun
|
||||||
|
{
|
||||||
|
trap ": foo" HUP # trigger part 2: any local trap (empty or not) on same signal in ksh function
|
||||||
|
}
|
||||||
|
for((i=0; i<2500; i++))
|
||||||
|
do ksh_fun
|
||||||
|
done
|
||||||
|
EOF
|
||||||
|
got=$( { "$SHELL" "$tmp/crash_rhbz1117404.ksh"; } 2>&1)
|
||||||
|
((!(e = $?))) || err_exit 'crash while handling function-local trap' \
|
||||||
|
"(got status $e$( ((e>128)) && print -n / && kill -l "$e"), $(printf %q "$got"))"
|
||||||
|
|
||||||
# ======
|
# ======
|
||||||
exit $((Errors<125?Errors:125))
|
exit $((Errors<125?Errors:125))
|
||||||
|
|
|
@ -852,7 +852,6 @@ actual=`get_value`
|
||||||
|
|
||||||
cat >$tmp/crash_rhbz1117404.ksh <<-'EOF'
|
cat >$tmp/crash_rhbz1117404.ksh <<-'EOF'
|
||||||
trap "" HUP # trigger part 1: signal ignored in main shell
|
trap "" HUP # trigger part 1: signal ignored in main shell
|
||||||
i=0
|
|
||||||
for((i=0; i<2500; i++))
|
for((i=0; i<2500; i++))
|
||||||
do (trap ": foo" HUP) # trigger part 2: any trap (empty or not) on same signal in subshell
|
do (trap ": foo" HUP) # trigger part 2: any trap (empty or not) on same signal in subshell
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue