From aff63e382da5870b199df1d34e56731b6b7b676c Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Mon, 10 Aug 2020 19:04:01 +0100 Subject: [PATCH] Stop 'ksh -i' unit tests affecting user command history Several regression tests invoke an "interactive" shell using 'ksh -i'. This records all the commands tested in the shell's history file. By default, that is the user's history file, ~/.sh_history. As ksh continuously synchronises history among instances, a ksh user who ran the regression tests ended up with a number of mysterious extra commands in their command history. src/cmd/ksh93/tests/shtests: - Before running any tests, set and export HISTFILE to a new history file in the temporary files directory. --- src/cmd/ksh93/tests/shtests | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/ksh93/tests/shtests b/src/cmd/ksh93/tests/shtests index 06b23a41e..1b79db274 100755 --- a/src/cmd/ksh93/tests/shtests +++ b/src/cmd/ksh93/tests/shtests @@ -293,6 +293,9 @@ then trap 'printf "\nTemporary files left in: %s\n" "$tmp"' EXIT else trap 'cd / && rm -rf "$tmp"' EXIT fi +# for interactive shell ('ksh -i') tests: avoid affecting ~/.sh_history +export HISTFILE=$tmp/sh_history + if (( compile )) then if whence $SHCOMP > /dev/null then :