mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
regress: avoid interference from systemwide /etc/ksh.kshrc
ksh, even non-interactive, loads /etc/ksh.kshrc by default. On some systems this can be a problem, e.g. OpenBSD, which installs a default /etc/ksh.kshrc which is designed for its version of pdksh. Quoth sh.1: On systems that support a system wide /etc/ksh.kshrc initialization file, if the filename generated by the expansion of ENV begins with /./ or ././ the system wide initialization file will not be executed. src/cmd/ksh93/tests/shtests, src/cmd/ksh93/tests/builtins.sh, src/cmd/ksh93/tests/options.sh, src/cmd/ksh93/tests/pty.sh: - Instead of emptying or unsetting ENV, ensure it is exported with a default value of /./dev/null so we skip loading the system-wide profile and load an empty user profile. - Where a specific ENV path was required for the tests, prefix it with '/.' so it starts with '/./'.
This commit is contained in:
parent
bb4745e897
commit
c870be9fea
4 changed files with 10 additions and 9 deletions
|
@ -638,7 +638,7 @@ then [[ $(kill -l HUP) == "$(kill -L HUP)" ]] || err_exit 'kill -l and kill -L a
|
||||||
[[ $(kill -L) == *'9) KILL'* ]] || err_exit 'kill -L output does not contain 9) KILL'
|
[[ $(kill -L) == *'9) KILL'* ]] || err_exit 'kill -L output does not contain 9) KILL'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset ENV
|
export ENV=/./dev/null
|
||||||
v=$($SHELL 2> /dev/null +o rc -ic $'getopts a:bc: opt --man\nprint $?')
|
v=$($SHELL 2> /dev/null +o rc -ic $'getopts a:bc: opt --man\nprint $?')
|
||||||
[[ $v == 2* ]] || err_exit 'getopts --man does not exit 2 for interactive shells'
|
[[ $v == 2* ]] || err_exit 'getopts --man does not exit 2 for interactive shells'
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ Command=${0##*/}
|
||||||
integer Errors=0
|
integer Errors=0
|
||||||
|
|
||||||
unset HISTFILE
|
unset HISTFILE
|
||||||
export LC_ALL=C ENV=
|
export LC_ALL=C ENV=/./dev/null
|
||||||
|
|
||||||
ulimit -c 0
|
ulimit -c 0
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ else
|
||||||
err_exit '-i ignores $ENV file'
|
err_exit '-i ignores $ENV file'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ENV=
|
export ENV=/./dev/null
|
||||||
if [[ -o privileged ]]
|
if [[ -o privileged ]]
|
||||||
then
|
then
|
||||||
[[ $(print env_hit | HOME=$tmp $SHELL 2>&1) == "OK" ]] &&
|
[[ $(print env_hit | HOME=$tmp $SHELL 2>&1) == "OK" ]] &&
|
||||||
|
@ -424,7 +424,7 @@ got=$(
|
||||||
$SHELL -c '[[ $- == *c* ]]' || err_exit 'option c not in $-'
|
$SHELL -c '[[ $- == *c* ]]' || err_exit 'option c not in $-'
|
||||||
> $tmp/.profile
|
> $tmp/.profile
|
||||||
for i in i l r s D E a b e f h k n t u v x B C G H
|
for i in i l r s D E a b e f h k n t u v x B C G H
|
||||||
do HOME=$tmp ENV= $SHELL -$i >/dev/null 2>&1 <<- ++EOF++ || err_exit "option $i not in \$-"
|
do HOME=$tmp ENV=/./dev/null $SHELL -$i >/dev/null 2>&1 <<- ++EOF++ || err_exit "option $i not in \$-"
|
||||||
[[ \$- == *$i* ]] || exit 1
|
[[ \$- == *$i* ]] || exit 1
|
||||||
++EOF++
|
++EOF++
|
||||||
done
|
done
|
||||||
|
@ -433,13 +433,13 @@ integer j=0
|
||||||
for i in interactive login restricted allexport notify errexit \
|
for i in interactive login restricted allexport notify errexit \
|
||||||
noglob trackall keyword noexec nounset verbose xtrace braceexpand \
|
noglob trackall keyword noexec nounset verbose xtrace braceexpand \
|
||||||
noclobber globstar rc
|
noclobber globstar rc
|
||||||
do HOME=$tmp ENV= $SHELL -o $i >/dev/null 2>&1 <<- ++EOF++ || err_exit "option $i not equivalent to ${letters:j:1}"
|
do HOME=$tmp ENV=/./dev/null $SHELL -o $i >/dev/null 2>&1 <<- ++EOF++ || err_exit "option $i not equivalent to ${letters:j:1}"
|
||||||
[[ \$- == *${letters:j:1}* ]] || exit 1
|
[[ \$- == *${letters:j:1}* ]] || exit 1
|
||||||
++EOF++
|
++EOF++
|
||||||
((j++))
|
((j++))
|
||||||
done
|
done
|
||||||
|
|
||||||
export ENV= PS1="(:$$:)"
|
export ENV=/./dev/null PS1="(:$$:)"
|
||||||
histfile=$tmp/history
|
histfile=$tmp/history
|
||||||
exp=$(HISTFILE=$histfile $SHELL -c $'function foo\n{\ncat\n}\ntype foo')
|
exp=$(HISTFILE=$histfile $SHELL -c $'function foo\n{\ncat\n}\ntype foo')
|
||||||
for var in HISTSIZE HISTFILE
|
for var in HISTSIZE HISTFILE
|
||||||
|
@ -559,6 +559,6 @@ done
|
||||||
# process source files from profiles as profile files
|
# process source files from profiles as profile files
|
||||||
print '. ./dotfile' > envfile
|
print '. ./dotfile' > envfile
|
||||||
print $'alias print=:\nprint foobar' > dotfile
|
print $'alias print=:\nprint foobar' > dotfile
|
||||||
[[ $(ENV=$PWD/envfile $SHELL -i -c : 2>/dev/null) == foobar ]] && err_exit 'files source from profile does not process aliases correctly'
|
[[ $(ENV=/.$PWD/envfile $SHELL -i -c : 2>/dev/null) == foobar ]] && err_exit 'files source from profile does not process aliases correctly'
|
||||||
|
|
||||||
exit $((Errors<125?Errors:125))
|
exit $((Errors<125?Errors:125))
|
||||||
|
|
|
@ -79,7 +79,7 @@ function tst
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
export PS1=':test-!: ' PS2='> ' PS4=': ' ENV= EXINIT= HISTFILE= TERM=dumb VISUAL=vi LC_ALL=C
|
export PS1=':test-!: ' PS2='> ' PS4=': ' ENV=/./dev/null EXINIT= HISTFILE= TERM=dumb VISUAL=vi LC_ALL=C
|
||||||
|
|
||||||
if ! pty $bintrue < /dev/null
|
if ! pty $bintrue < /dev/null
|
||||||
then err_exit pty command hangs on $bintrue -- tests skipped
|
then err_exit pty command hangs on $bintrue -- tests skipped
|
||||||
|
|
|
@ -165,7 +165,8 @@ function valxml
|
||||||
return $errors
|
return $errors
|
||||||
}
|
}
|
||||||
|
|
||||||
unset DISPLAY ENV FIGNORE HISTFILE
|
unset DISPLAY FIGNORE HISTFILE
|
||||||
|
export ENV=/./dev/null
|
||||||
trap + PIPE # unadvertized -- set SIGPIPE to SIG_DFL #
|
trap + PIPE # unadvertized -- set SIGPIPE to SIG_DFL #
|
||||||
|
|
||||||
integer compile=-1 posix=-1 utf8=-1
|
integer compile=-1 posix=-1 utf8=-1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue