mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
regress tests: remove use of unportable direct paths to commands
Many tests used direct paths to some commands, mostly /bin/echo and /bin/cat. This is unportable (breaks on e.g. NixOS). The correct way is to obtain the direct path using 'whence -p'. There was also one use of '/usr/bin/pstack' in tests/comvario.sh that seemed bogus. Apparently this was supposed to analyse a core file after a crash. Even on Solaris and Linux, where that command exists, the argument is documented to be a PID, not a core file. If this ever worked anywhere, then it was system-specific enough to be useless here, so I've removed it. (cherry picked from commit 4563b8bc651cd9cb18dc73f56a041f7ac5534395)
This commit is contained in:
parent
3552a2bafd
commit
b6b8b522a7
13 changed files with 53 additions and 48 deletions
|
@ -36,6 +36,8 @@ tmp=$(
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||||
|
bincat=$(whence -p cat)
|
||||||
|
binecho=$(whence -p echo)
|
||||||
|
|
||||||
# test basic file operations like redirection, pipes, file expansion
|
# test basic file operations like redirection, pipes, file expansion
|
||||||
set -- \
|
set -- \
|
||||||
|
@ -155,7 +157,7 @@ then err_exit "$foobar is not foobar"
|
||||||
fi
|
fi
|
||||||
{
|
{
|
||||||
print foo
|
print foo
|
||||||
/bin/echo bar
|
"$binecho" bar
|
||||||
print bam
|
print bam
|
||||||
} > $tmp/foobar
|
} > $tmp/foobar
|
||||||
if [[ $( < $tmp/foobar) != $'foo\nbar\nbam' ]]
|
if [[ $( < $tmp/foobar) != $'foo\nbar\nbam' ]]
|
||||||
|
@ -163,17 +165,17 @@ then err_exit "output file pointer not shared correctly"
|
||||||
fi
|
fi
|
||||||
cat > $tmp/foobar <<\!
|
cat > $tmp/foobar <<\!
|
||||||
print foo
|
print foo
|
||||||
/bin/echo bar
|
"$binecho" bar
|
||||||
print bam
|
print bam
|
||||||
!
|
!
|
||||||
chmod +x $tmp/foobar
|
chmod +x $tmp/foobar
|
||||||
if [[ $($tmp/foobar) != $'foo\nbar\nbam' ]]
|
if [[ $(export binecho; $tmp/foobar) != $'foo\nbar\nbam' ]]
|
||||||
then err_exit "script not working"
|
then err_exit "script not working"
|
||||||
fi
|
fi
|
||||||
if [[ $($tmp/foobar | /bin/cat) != $'foo\nbar\nbam' ]]
|
if [[ $(export binecho; $tmp/foobar | "$bincat") != $'foo\nbar\nbam' ]]
|
||||||
then err_exit "script | cat not working"
|
then err_exit "script | cat not working"
|
||||||
fi
|
fi
|
||||||
if [[ $( $tmp/foobar) != $'foo\nbar\nbam' ]]
|
if [[ $(export binecho; $tmp/foobar) != $'foo\nbar\nbam' ]]
|
||||||
then err_exit "output file pointer not shared correctly"
|
then err_exit "output file pointer not shared correctly"
|
||||||
fi
|
fi
|
||||||
rm -f $tmp/foobar
|
rm -f $tmp/foobar
|
||||||
|
@ -181,13 +183,13 @@ x=$( (print foo) ; (print bar) )
|
||||||
if [[ $x != $'foo\nbar' ]]
|
if [[ $x != $'foo\nbar' ]]
|
||||||
then err_exit " ( (print foo);(print bar ) failed"
|
then err_exit " ( (print foo);(print bar ) failed"
|
||||||
fi
|
fi
|
||||||
x=$( (/bin/echo foo) ; (print bar) )
|
x=$( ("$binecho" foo) ; (print bar) )
|
||||||
if [[ $x != $'foo\nbar' ]]
|
if [[ $x != $'foo\nbar' ]]
|
||||||
then err_exit " ( (/bin/echo);(print bar ) failed"
|
then err_exit " ( ("$binecho");(print bar ) failed"
|
||||||
fi
|
fi
|
||||||
x=$( (/bin/echo foo) ; (/bin/echo bar) )
|
x=$( ("$binecho" foo) ; ("$binecho" bar) )
|
||||||
if [[ $x != $'foo\nbar' ]]
|
if [[ $x != $'foo\nbar' ]]
|
||||||
then err_exit " ( (/bin/echo);(/bin/echo bar ) failed"
|
then err_exit " ( ("$binecho");("$binecho" bar ) failed"
|
||||||
fi
|
fi
|
||||||
cat > $tmp/script <<\!
|
cat > $tmp/script <<\!
|
||||||
if [[ -p /dev/fd/0 ]]
|
if [[ -p /dev/fd/0 ]]
|
||||||
|
@ -221,7 +223,7 @@ if [[ $x != "hello there" ]]
|
||||||
then err_exit "scripts in subshells fail"
|
then err_exit "scripts in subshells fail"
|
||||||
fi
|
fi
|
||||||
cd ~- || err_exit "cd back failed"
|
cd ~- || err_exit "cd back failed"
|
||||||
x=$( (/bin/echo foo) 2> /dev/null )
|
x=$( ("$binecho" foo) 2> /dev/null )
|
||||||
if [[ $x != foo ]]
|
if [[ $x != foo ]]
|
||||||
then err_exit "subshell in command substitution fails"
|
then err_exit "subshell in command substitution fails"
|
||||||
fi
|
fi
|
||||||
|
@ -233,15 +235,15 @@ then err_exit "command substitution with stdout closed failed"
|
||||||
fi
|
fi
|
||||||
exec >& 9
|
exec >& 9
|
||||||
cd $pwd
|
cd $pwd
|
||||||
x=$(cat <<\! | $SHELL
|
x=$(export binecho bincat; cat <<\! | $SHELL
|
||||||
/bin/echo | /bin/cat
|
"$binecho" | "$bincat"
|
||||||
/bin/echo hello
|
"$binecho" hello
|
||||||
!
|
!
|
||||||
)
|
)
|
||||||
if [[ $x != $'\n'hello ]]
|
if [[ $x != $'\n'hello ]]
|
||||||
then err_exit "$SHELL not working when standard input is a pipe"
|
then err_exit "$SHELL not working when standard input is a pipe"
|
||||||
fi
|
fi
|
||||||
x=$( (/bin/echo hello) 2> /dev/null )
|
x=$( ("$binecho" hello) 2> /dev/null )
|
||||||
if [[ $x != hello ]]
|
if [[ $x != hello ]]
|
||||||
then err_exit "subshell in command substitution with 1 closed fails"
|
then err_exit "subshell in command substitution with 1 closed fails"
|
||||||
fi
|
fi
|
||||||
|
@ -265,22 +267,22 @@ fi
|
||||||
trap - INT
|
trap - INT
|
||||||
cat > $tmp/script <<- \!
|
cat > $tmp/script <<- \!
|
||||||
read line
|
read line
|
||||||
/bin/cat
|
"$bincat"
|
||||||
!
|
!
|
||||||
if [[ $($SHELL $tmp/script <<!
|
if [[ $(export bincat; $SHELL $tmp/script <<!
|
||||||
one
|
one
|
||||||
two
|
two
|
||||||
!
|
!
|
||||||
) != two ]]
|
) != two ]]
|
||||||
then err_exit "standard input not positioned correctly"
|
then err_exit "standard input not positioned correctly"
|
||||||
fi
|
fi
|
||||||
word=$(print $'foo\nbar' | { read line; /bin/cat;})
|
word=$(print $'foo\nbar' | { read line; "$bincat";})
|
||||||
if [[ $word != bar ]]
|
if [[ $word != bar ]]
|
||||||
then err_exit "pipe to { read line; /bin/cat;} not working"
|
then err_exit "pipe to { read line; $bincat;} not working"
|
||||||
fi
|
fi
|
||||||
word=$(print $'foo\nbar' | ( read line; /bin/cat) )
|
word=$(print $'foo\nbar' | ( read line; "$bincat") )
|
||||||
if [[ $word != bar ]]
|
if [[ $word != bar ]]
|
||||||
then err_exit "pipe to ( read line; /bin/cat) not working"
|
then err_exit "pipe to ( read line; $bincat) not working"
|
||||||
fi
|
fi
|
||||||
if [[ $(print x{a,b}y) != 'xay xby' ]]
|
if [[ $(print x{a,b}y) != 'xay xby' ]]
|
||||||
then err_exit 'brace expansion not working'
|
then err_exit 'brace expansion not working'
|
||||||
|
|
|
@ -36,6 +36,7 @@ tmp=$(
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||||
|
bincat=$(whence -p cat)
|
||||||
|
|
||||||
# test shell builtin commands
|
# test shell builtin commands
|
||||||
builtin getconf
|
builtin getconf
|
||||||
|
@ -101,7 +102,7 @@ hello \
|
||||||
!
|
!
|
||||||
[[ $REPLY == 'hello world' ]] || err_exit "read continuation2 failed"
|
[[ $REPLY == 'hello world' ]] || err_exit "read continuation2 failed"
|
||||||
print "one\ntwo" | { read line
|
print "one\ntwo" | { read line
|
||||||
print $line | /bin/cat > /dev/null
|
print $line | "$bincat" > /dev/null
|
||||||
read line
|
read line
|
||||||
}
|
}
|
||||||
read <<\!
|
read <<\!
|
||||||
|
@ -559,6 +560,7 @@ builtin cat
|
||||||
out=$tmp/seq.out
|
out=$tmp/seq.out
|
||||||
for ((i=1; i<=11; i++)); do print "$i"; done >$out
|
for ((i=1; i<=11; i++)); do print "$i"; done >$out
|
||||||
cmp -s <(print -- "$($bincat<( $bincat $out ) )") <(print -- "$(cat <( cat $out ) )") || err_exit "builtin cat differs from $bincat"
|
cmp -s <(print -- "$($bincat<( $bincat $out ) )") <(print -- "$(cat <( cat $out ) )") || err_exit "builtin cat differs from $bincat"
|
||||||
|
builtin -d cat
|
||||||
|
|
||||||
[[ $($SHELL -c '{ printf %R "["; print ok;}' 2> /dev/null) == ok ]] || err_exit $'\'printf %R "["\' causes shell to abort'
|
[[ $($SHELL -c '{ printf %R "["; print ok;}' 2> /dev/null) == ok ]] || err_exit $'\'printf %R "["\' causes shell to abort'
|
||||||
|
|
||||||
|
|
|
@ -529,11 +529,6 @@ print -v c2
|
||||||
[[ "${out.stdout}" != '' ]] || err_exit "$0: Expected nonempty stdout."
|
[[ "${out.stdout}" != '' ]] || err_exit "$0: Expected nonempty stdout."
|
||||||
[[ "${out.stderr}" == '' ]] || err_exit "$0: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")"
|
[[ "${out.stderr}" == '' ]] || err_exit "$0: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")"
|
||||||
|
|
||||||
if [[ -f 'core' && -x '/usr/bin/pstack' ]] ; then
|
|
||||||
pstack 'core'
|
|
||||||
rm 'core'
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ tmp=$(
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||||
|
binecho=$(whence -p echo)
|
||||||
|
|
||||||
integer foo=33
|
integer foo=33
|
||||||
bar=bye
|
bar=bye
|
||||||
|
@ -141,7 +142,7 @@ fi
|
||||||
if [[ $PWD != "$dir" ]]
|
if [[ $PWD != "$dir" ]]
|
||||||
then err_exit 'cd inside nested subshell changes $PWD'
|
then err_exit 'cd inside nested subshell changes $PWD'
|
||||||
fi
|
fi
|
||||||
fun() /bin/echo hello
|
fun() "$binecho" hello
|
||||||
if [[ $(fun) != hello ]]
|
if [[ $(fun) != hello ]]
|
||||||
then err_exit one line functions not working
|
then err_exit one line functions not working
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -105,7 +105,7 @@ case $* in
|
||||||
'b B') contrary=1 ;;
|
'b B') contrary=1 ;;
|
||||||
b|B) ignorant=1 ;;
|
b|B) ignorant=1 ;;
|
||||||
esac
|
esac
|
||||||
set -- $(LC_ALL=C /bin/sh -c 'echo [a-c]')
|
set -- $(LC_ALL=C sh -c 'echo [a-c]')
|
||||||
case $* in
|
case $* in
|
||||||
B) aware=1 ;;
|
B) aware=1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -36,6 +36,7 @@ tmp=$(
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||||
|
bincat=$(whence -p cat)
|
||||||
|
|
||||||
f=$tmp/here1
|
f=$tmp/here1
|
||||||
g=$tmp/here2
|
g=$tmp/here2
|
||||||
|
@ -125,7 +126,7 @@ done
|
||||||
} > $f
|
} > $f
|
||||||
chmod +x "$f"
|
chmod +x "$f"
|
||||||
$SHELL "$f" > /dev/null || err_exit "large here-doc with command substitution fails"
|
$SHELL "$f" > /dev/null || err_exit "large here-doc with command substitution fails"
|
||||||
x=$(/bin/cat <<!
|
x=$("$bincat" <<!
|
||||||
$0
|
$0
|
||||||
!
|
!
|
||||||
)
|
)
|
||||||
|
@ -186,7 +187,7 @@ cat > "$f" <<- '!!!!'
|
||||||
exec 0<&-
|
exec 0<&-
|
||||||
foobar()
|
foobar()
|
||||||
{
|
{
|
||||||
/bin/cat <<- !
|
"$bincat" <<- !
|
||||||
foobar
|
foobar
|
||||||
!
|
!
|
||||||
}
|
}
|
||||||
|
@ -212,7 +213,7 @@ cat > "$f" <<- '!!!!'
|
||||||
EOF
|
EOF
|
||||||
print -r -- "$(foobar)"
|
print -r -- "$(foobar)"
|
||||||
!!!!
|
!!!!
|
||||||
if [[ $($SHELL "$f") != foobar ]]
|
if [[ $(export bincat; "$SHELL" "$f") != foobar ]]
|
||||||
then err_exit 'here document with stdin closed failed'
|
then err_exit 'here document with stdin closed failed'
|
||||||
fi
|
fi
|
||||||
printf $'cat <<# \\!!!\n\thello\n\t\tworld\n!!!' > $f
|
printf $'cat <<# \\!!!\n\thello\n\t\tworld\n!!!' > $f
|
||||||
|
|
|
@ -478,9 +478,9 @@ print hello there world > $tmp/foobar
|
||||||
$SHELL -c "sed -e 's/there //' $tmp/foobar >; $tmp/foobar"
|
$SHELL -c "sed -e 's/there //' $tmp/foobar >; $tmp/foobar"
|
||||||
[[ $(<$tmp/foobar) == 'hello world' ]] || err_exit '>; redirection not working with -c on a simple command'
|
[[ $(<$tmp/foobar) == 'hello world' ]] || err_exit '>; redirection not working with -c on a simple command'
|
||||||
|
|
||||||
rm -f "$tmp/junk"
|
binfalse=$(whence -p false)
|
||||||
for (( i=1; i < 50; i++ ))
|
for (( i=1; i < 50; i++ ))
|
||||||
do out=$(/bin/ls "$tmp/junk" 2>/dev/null)
|
do out=$("$binfalse" 2>/dev/null)
|
||||||
if (( $? == 0 ))
|
if (( $? == 0 ))
|
||||||
then err_exit 'wrong error code with redirection'
|
then err_exit 'wrong error code with redirection'
|
||||||
break
|
break
|
||||||
|
|
|
@ -41,6 +41,7 @@ tmp=$(
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||||
|
bincat=$(whence -p cat)
|
||||||
|
|
||||||
if [[ $( ${SHELL-ksh} -s hello<<-\!
|
if [[ $( ${SHELL-ksh} -s hello<<-\!
|
||||||
print $1
|
print $1
|
||||||
|
@ -367,7 +368,7 @@ pipeline=(
|
||||||
( nopipefail=1 pipefail=1 command='true|true|false' )
|
( nopipefail=1 pipefail=1 command='true|true|false' )
|
||||||
( nopipefail=1 pipefail=1 command='false|false|false' )
|
( nopipefail=1 pipefail=1 command='false|false|false' )
|
||||||
( nopipefail=0 pipefail=0 command='true|true|true' )
|
( nopipefail=0 pipefail=0 command='true|true|true' )
|
||||||
( nopipefail=0 pipefail=0 command='print hi|(sleep 1;/bin/cat)>/dev/null' )
|
( nopipefail=0 pipefail=0 command='print hi|(sleep 1;"$bincat")>/dev/null' )
|
||||||
)
|
)
|
||||||
set --nopipefail
|
set --nopipefail
|
||||||
for ((i = 0; i < ${#pipeline[@]}; i++ ))
|
for ((i = 0; i < ${#pipeline[@]}; i++ ))
|
||||||
|
|
|
@ -27,6 +27,8 @@ alias err_exit='err_exit $LINENO'
|
||||||
|
|
||||||
Command=${0##*/}
|
Command=${0##*/}
|
||||||
integer Errors=0
|
integer Errors=0
|
||||||
|
binecho=$(whence -p echo)
|
||||||
|
|
||||||
if [[ 'hi there' != "hi there" ]]
|
if [[ 'hi there' != "hi there" ]]
|
||||||
then err_exit "single quotes not the same as double quotes"
|
then err_exit "single quotes not the same as double quotes"
|
||||||
fi
|
fi
|
||||||
|
@ -184,7 +186,7 @@ fi
|
||||||
if [[ $x$ != '$hi$' ]]
|
if [[ $x$ != '$hi$' ]]
|
||||||
then err_exit ' $x$, with x=$hi, does not expand to $hi$'
|
then err_exit ' $x$, with x=$hi, does not expand to $hi$'
|
||||||
fi
|
fi
|
||||||
set -- $(/bin/echo foo;sleep 1;/bin/echo bar)
|
set -- $("$binecho" foo; sleep 1; "$binecho" bar)
|
||||||
if [[ $# != 2 ]]
|
if [[ $# != 2 ]]
|
||||||
then err_exit 'word splitting after command substitution not working'
|
then err_exit 'word splitting after command substitution not working'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -36,6 +36,7 @@ tmp=$(
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||||
|
binecho=$(whence -p echo)
|
||||||
|
|
||||||
# test restricted shell
|
# test restricted shell
|
||||||
pwd=$PWD
|
pwd=$PWD
|
||||||
|
@ -57,7 +58,7 @@ ln -s $SHELL rksh
|
||||||
PATH=$PWD:$PATH
|
PATH=$PWD:$PATH
|
||||||
rksh -c '[[ -o restricted ]]' || err_exit 'restricted option not set'
|
rksh -c '[[ -o restricted ]]' || err_exit 'restricted option not set'
|
||||||
[[ $(rksh -c 'print hello') == hello ]] || err_exit 'unable to run print'
|
[[ $(rksh -c 'print hello') == hello ]] || err_exit 'unable to run print'
|
||||||
check_restricted /bin/echo || err_exit '/bin/echo not resticted'
|
check_restricted "$binecho" || err_exit "$binecho not resticted"
|
||||||
check_restricted ./echo || err_exit './echo not resticted'
|
check_restricted ./echo || err_exit './echo not resticted'
|
||||||
check_restricted 'SHELL=ksh' || err_exit 'SHELL assignment not resticted'
|
check_restricted 'SHELL=ksh' || err_exit 'SHELL assignment not resticted'
|
||||||
check_restricted 'PATH=/bin' || err_exit 'PATH assignment not resticted'
|
check_restricted 'PATH=/bin' || err_exit 'PATH assignment not resticted'
|
||||||
|
@ -70,7 +71,7 @@ print 'echo hello' > script
|
||||||
chmod +x ./script
|
chmod +x ./script
|
||||||
! check_restricted script || err_exit 'script without builtins should run in restricted mode'
|
! check_restricted script || err_exit 'script without builtins should run in restricted mode'
|
||||||
check_restricted ./script || err_exit 'script with / in name should not run in restricted mode'
|
check_restricted ./script || err_exit 'script with / in name should not run in restricted mode'
|
||||||
print '/bin/echo hello' > script
|
printf '%q hello\n' "$binecho" > script
|
||||||
! check_restricted script || err_exit 'script with pathnames should run in restricted mode'
|
! check_restricted script || err_exit 'script with pathnames should run in restricted mode'
|
||||||
print 'echo hello> file' > script
|
print 'echo hello> file' > script
|
||||||
! check_restricted script || err_exit 'script with output redirection should run in restricted mode'
|
! check_restricted script || err_exit 'script with output redirection should run in restricted mode'
|
||||||
|
|
|
@ -155,7 +155,7 @@ done
|
||||||
(( d==2000 )) || err_exit "trap '' CHLD causes side effects d=$d"
|
(( d==2000 )) || err_exit "trap '' CHLD causes side effects d=$d"
|
||||||
trap - CHLD
|
trap - CHLD
|
||||||
|
|
||||||
x=$($SHELL 2> /dev/null -ic '/bin/notfound; sleep .5 & sleep 1;jobs')
|
x=$($SHELL 2> /dev/null -ic '/dev/null/notfound; sleep .5 & sleep 1;jobs')
|
||||||
[[ $x == *Done* ]] || err_exit 'SIGCHLD blocked after notfound'
|
[[ $x == *Done* ]] || err_exit 'SIGCHLD blocked after notfound'
|
||||||
x=$($SHELL 2> /dev/null -ic 'kill -0 12345678901234567876; sleep .5 & sleep 1;jobs')
|
x=$($SHELL 2> /dev/null -ic 'kill -0 12345678901234567876; sleep .5 & sleep 1;jobs')
|
||||||
[[ $x == *Done* ]] || err_exit 'SIGCHLD blocked after error message'
|
[[ $x == *Done* ]] || err_exit 'SIGCHLD blocked after error message'
|
||||||
|
|
|
@ -283,18 +283,18 @@ then float s=$SECONDS
|
||||||
(( SECONDS-s < 4 )) && err_exit 'parent completes early'
|
(( SECONDS-s < 4 )) && err_exit 'parent completes early'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
yes=$(whence -p yes)
|
yes() for ((;;)); do print y; done
|
||||||
if [[ $yes ]]
|
|
||||||
then for exp in TERM VTALRM PIPE
|
for exp in TERM VTALRM PIPE
|
||||||
do if [[ ${SIG[$exp]} ]]
|
do if [[ ${SIG[$exp]} ]]
|
||||||
then {
|
then {
|
||||||
$SHELL <<- EOF
|
bindate=$(whence -p date) "$SHELL" <<- EOF
|
||||||
foo() { return 0; }
|
foo() { return 0; }
|
||||||
trap foo EXIT
|
trap foo EXIT
|
||||||
{ sleep 2; kill -$exp \$\$; sleep 3; kill -0 \$\$ && kill -KILL \$\$; } &
|
{ sleep 2; kill -$exp \$\$; sleep 3; kill -0 \$\$ && kill -KILL \$\$; } &
|
||||||
$yes |
|
yes |
|
||||||
while read yes
|
while read yes
|
||||||
do (/bin/date; sleep .1)
|
do ("\$bindate"; sleep .1)
|
||||||
done > /dev/null
|
done > /dev/null
|
||||||
EOF
|
EOF
|
||||||
} 2>> /dev/null
|
} 2>> /dev/null
|
||||||
|
@ -302,7 +302,6 @@ then for exp in TERM VTALRM PIPE
|
||||||
[[ $exp == $got ]] || err_exit "kill -$exp \$\$ failed, required termination by signal '$got'"
|
[[ $exp == $got ]] || err_exit "kill -$exp \$\$ failed, required termination by signal '$got'"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
SECONDS=0
|
SECONDS=0
|
||||||
$SHELL 2> /dev/null -c 'sleep 2 && kill $$ & trap "print done; exit 3" EXIT; (sleep 5); print finished' > $tmp/sig
|
$SHELL 2> /dev/null -c 'sleep 2 && kill $$ & trap "print done; exit 3" EXIT; (sleep 5); print finished' > $tmp/sig
|
||||||
|
|
|
@ -39,6 +39,7 @@ trap 'cd / && rm -rf "$tmp"' EXIT
|
||||||
|
|
||||||
builtin getconf
|
builtin getconf
|
||||||
bincat=$(PATH=$(getconf PATH) whence -p cat)
|
bincat=$(PATH=$(getconf PATH) whence -p cat)
|
||||||
|
binecho=$(PATH=$(getconf PATH) whence -p echo)
|
||||||
|
|
||||||
z=()
|
z=()
|
||||||
z.foo=( [one]=hello [two]=(x=3 y=4) [three]=hi)
|
z.foo=( [one]=hello [two]=(x=3 y=4) [three]=hi)
|
||||||
|
@ -466,9 +467,9 @@ exp=ok
|
||||||
got=$($SHELL -c "$cmd" 2>&1)
|
got=$($SHELL -c "$cmd" 2>&1)
|
||||||
[[ $got == "$exp" ]] || err_exit "'$cmd' failed -- expected '$exp', got '$got'"
|
[[ $got == "$exp" ]] || err_exit "'$cmd' failed -- expected '$exp', got '$got'"
|
||||||
|
|
||||||
cmd='eval "for i in 1 2; do eval /bin/echo x; done"'
|
cmd='eval '\''for i in 1 2; do eval "\"\$binecho\" x"; done'\'
|
||||||
exp=$'x\nx'
|
exp=$'x\nx'
|
||||||
got=$($SHELL -c "$cmd")
|
got=$(export binecho; $SHELL -c "$cmd")
|
||||||
if [[ $got != "$exp" ]]
|
if [[ $got != "$exp" ]]
|
||||||
then EXP=$(printf %q "$exp")
|
then EXP=$(printf %q "$exp")
|
||||||
GOT=$(printf %q "$got")
|
GOT=$(printf %q "$got")
|
||||||
|
@ -482,7 +483,7 @@ $SHELL -c 'sleep 20 & pid=$!; { x=$( ( seq 60000 ) );kill -9 $pid;}&;wait $pid'
|
||||||
|
|
||||||
(.sh.foo=foobar)
|
(.sh.foo=foobar)
|
||||||
[[ ${.sh.foo} == foobar ]] && err_exit '.sh subvariables in subshells remain set'
|
[[ ${.sh.foo} == foobar ]] && err_exit '.sh subvariables in subshells remain set'
|
||||||
[[ $($SHELL -c 'print 1 | : "$(/bin/cat <(/bin/cat))"') ]] && err_exit 'process substitution not working correctly in subshells'
|
[[ $($SHELL -c 'print 1 | : "$("$bincat" <("$bincat"))"') ]] && err_exit 'process substitution not working correctly in subshells'
|
||||||
|
|
||||||
# config hang bug
|
# config hang bug
|
||||||
integer i
|
integer i
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue