From 1435e8e5c51a9d7bb38b7a337058d80a8b78d79a Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Mon, 20 Dec 2021 23:13:36 +0100 Subject: [PATCH] maint: update tests/init.sh from gnulib * tests/init.sh: Sync from gnulib/tests/init.sh. A recent gnulib update (4f497bf3c) missed this. --- tests/init.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/init.sh b/tests/init.sh index 9ef834888..a975592ff 100755 --- a/tests/init.sh +++ b/tests/init.sh @@ -426,6 +426,23 @@ setup_ () for sig_ in 1 2 3 13 15; do eval "trap 'Exit $(expr $sig_ + 128)' $sig_" done + + # Remove relative and non-accessible directories from PATH, including '.' + # and Zero-length entries. + saved_IFS="$IFS" + IFS=: + new_PATH= + sep_= + for dir in $PATH; do + case "$dir" in + /*) test -d "$dir/." || continue + new_PATH="${new_PATH}${sep_}${dir}" + sep_=':';; + esac + done + IFS="$saved_IFS" + PATH="$new_PATH" + export PATH } # This is a stub function that is run upon trap (upon regular exit and -- 2.34.1