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
|
|
@ -29,7 +29,7 @@ Command=${0##*/}
|
|||
integer Errors=0
|
||||
|
||||
unset HISTFILE
|
||||
export LC_ALL=C ENV=
|
||||
export LC_ALL=C ENV=/./dev/null
|
||||
|
||||
ulimit -c 0
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ else
|
|||
err_exit '-i ignores $ENV file'
|
||||
fi
|
||||
|
||||
export ENV=
|
||||
export ENV=/./dev/null
|
||||
if [[ -o privileged ]]
|
||||
then
|
||||
[[ $(print env_hit | HOME=$tmp $SHELL 2>&1) == "OK" ]] &&
|
||||
|
|
@ -424,7 +424,7 @@ got=$(
|
|||
$SHELL -c '[[ $- == *c* ]]' || err_exit 'option c not in $-'
|
||||
> $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
|
||||
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
|
||||
++EOF++
|
||||
done
|
||||
|
|
@ -433,13 +433,13 @@ integer j=0
|
|||
for i in interactive login restricted allexport notify errexit \
|
||||
noglob trackall keyword noexec nounset verbose xtrace braceexpand \
|
||||
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
|
||||
++EOF++
|
||||
((j++))
|
||||
done
|
||||
|
||||
export ENV= PS1="(:$$:)"
|
||||
export ENV=/./dev/null PS1="(:$$:)"
|
||||
histfile=$tmp/history
|
||||
exp=$(HISTFILE=$histfile $SHELL -c $'function foo\n{\ncat\n}\ntype foo')
|
||||
for var in HISTSIZE HISTFILE
|
||||
|
|
@ -559,6 +559,6 @@ done
|
|||
# process source files from profiles as profile files
|
||||
print '. ./dotfile' > envfile
|
||||
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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue