]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: update tests/init.sh from gnulib
authorBernhard Voelker <mail@bernhard-voelker.de>
Mon, 20 Dec 2021 22:13:36 +0000 (23:13 +0100)
committerBernhard Voelker <mail@bernhard-voelker.de>
Mon, 20 Dec 2021 22:13:36 +0000 (23:13 +0100)
* tests/init.sh: Sync from gnulib/tests/init.sh.
A recent gnulib update (4f497bf3c) missed this.

tests/init.sh

index 9ef834888c63df3f68bf465a9178edff96766b10..a975592ff91c0f6c0ce0698cca8e13054c4adeca 100755 (executable)
@@ -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