From 01d0f037b6d38c727fc1fc66490d446ad0242542 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 23 Apr 2025 11:29:39 -0400 Subject: [PATCH] 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. --- .gitlab/ci/env.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab/ci/env.sh b/.gitlab/ci/env.sh index aa709a892e..de5cf6f0c8 100644 --- a/.gitlab/ci/env.sh +++ b/.gitlab/ci/env.sh @@ -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