ci: Remove superuser tools from PATH in Linux jobs

Our Linux CI jobs incidentally run as `root` in their containers, but
do not need any superuser tools.  Drop `sbin` entries from the `PATH`.
This also avoids finding user tools through Fedora 42's `sbin -> bin`
symbolic links.
This commit is contained in:
Brad King
2025-04-23 11:29:39 -04:00
parent 8b1b201154
commit 01d0f037b6

View File

@@ -22,3 +22,10 @@ fi
if test -r ".gitlab/ci/env_${CMAKE_CONFIGURATION}.sh"; then
source ".gitlab/ci/env_${CMAKE_CONFIGURATION}.sh"
fi
case "$(uname -s)-$(uname -m)" in
Linux-*)
# Remove superuser tools from PATH.
export PATH=$(echo "$PATH" | sed 's|:[^:]*/sbin:|:|g')
;;
esac