1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Really stop affecting user command history (re: aff63e38)

The fix was incomplete because some tests have to unset HISTFILE,
which reverted them to using ~/.sh_history by default.

src/cmd/ksh93/tests/shtests:
- Instead of setting HISTFILE, set HOME to the temporary directory
  $tmp, so nothing will write to the real user directory and the
  default history file is $tmp/.sh_history.

src/cmd/ksh93/tests/attributes.sh:
- Restore HISTFILE after a test that requires setting HISTFILE=foo.
This commit is contained in:
Martijn Dekker 2020-08-13 23:04:29 +01:00
parent cadd1a81dc
commit 64d04e717b
2 changed files with 4 additions and 1 deletions

View file

@ -408,10 +408,12 @@ typeset groupDB="" userDB=""
typeset -l -L1 DBPick=""
[[ -n "$groupDB" ]] && err_exit 'typeset -l -L1 causes unwanted side effect'
[[ -v HISTFILE ]] && saveHISTFILE=$HISTFILE || unset saveHISTFILE
HISTFILE=foo
typeset -u PS1='hello --- '
HISTFILE=foo
[[ $HISTFILE == foo ]] || err_exit 'typeset -u PS1 affects HISTFILE'
[[ -v saveHISTFILE ]] && HISTFILE=$saveHISTFILE || unset HISTFILE
typeset -a a=( aA= ZQ= bA= bA= bw= Cg= )
typeset -b x

View file

@ -298,7 +298,8 @@ else trap 'cd / && rm -rf "$tmp"' EXIT
fi
# for interactive shell ('ksh -i') tests: avoid affecting ~/.sh_history
export HISTFILE=$tmp/sh_history
# (some tests must unset or modify $HISTFILE, so set $HOME instead)
export HOME=$tmp
if (( compile ))
then if whence $SHCOMP > /dev/null