From 069a506ac71cbd40a48c68604a4793b3f78282c6 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 1 Oct 2026 15:55:56 +0200 Subject: [PATCH] jenkins, ci-automation: Drop POSIXLY_CORRECT from environment It wasn't in the environment on purpose, just a side effect of using `sh` instead of `bash`. Signed-off-by: Krzesimir Nowak --- ci-automation/garbage_collect_github_ci_sdk.sh | 2 +- ci-automation/garbage_collect_releases.sh | 7 ++----- jenkins/systemd-run-wrap.sh | 6 ++++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ci-automation/garbage_collect_github_ci_sdk.sh b/ci-automation/garbage_collect_github_ci_sdk.sh index 6a05ca31741..b1bf83fcdf7 100644 --- a/ci-automation/garbage_collect_github_ci_sdk.sh +++ b/ci-automation/garbage_collect_github_ci_sdk.sh @@ -70,7 +70,7 @@ function _garbage_collect_github_ci_impl() { echo "${versions_sorted}" | awk '{printf "%5d %s\n", NR, $0}' local purge_versions - mapfile -t purge_versions < <(unset POSIXLY_CORRECT; \ + mapfile -t purge_versions < <( echo "${versions_sorted}" \ | awk -v keep="${keep}" -v min_age="${min_age_date}" '{ if (keep > 0) { diff --git a/ci-automation/garbage_collect_releases.sh b/ci-automation/garbage_collect_releases.sh index 4ac2f628f86..1b75a3731ef 100644 --- a/ci-automation/garbage_collect_releases.sh +++ b/ci-automation/garbage_collect_releases.sh @@ -43,10 +43,7 @@ function _garbage_collect_releases_impl() { source ci-automation/ci_automation_common.sh local sshcmd="$(gen_sshcmd)" - local keep=$( - # For some reasons this is set to the empty string in some environments and it makes gawk - # behave like POSIX awk (i.e. no 'gensub'). - unset POSIXLY_CORRECT + local keep=$( curl -s "${RELEASES_JSON_FEED}" \ | jq -r 'keys_unsorted | .[] | match("[0-9]+\\.[0-9]+\\.[0-9]+") | .string' \ | sort -Vr \ @@ -102,7 +99,7 @@ function _garbage_collect_releases_impl() { # skip if candidate version is marked for keeping OR if it's a new release about to be published # or if it ships an SDK used by a version in the keep list. if printf "%s\n" "${keep_versions[@]}" \ - | { unset POSIXLY_CORRECT ; awk -v candidate_version="${version}" -v path="${dir}" ' + | { awk -v candidate_version="${version}" -v path="${dir}" ' BEGIN { # Candidate version (from build cache directory) that was passed in candidate_version variable candidate_major = gensub("([0-9]+)\\.[0-9]+\\.[0-9]+","\\1","g", candidate_version) + 0 diff --git a/jenkins/systemd-run-wrap.sh b/jenkins/systemd-run-wrap.sh index 392dde7fecf..4b5c4e0b974 100755 --- a/jenkins/systemd-run-wrap.sh +++ b/jenkins/systemd-run-wrap.sh @@ -7,8 +7,10 @@ export PATH="$PATH:/opt/bin" # Use a system session unit because the user session may not be set up correctly in a CI env ARGS=("--system" "--collect" "--same-dir" "--pipe" "--wait" "--property=User=$USER" "--property=Group=$USER") -# Extra "sh -c" is needed to only export the exported variables -for VARNAME in $(sh -c 'compgen -v'); do +# Extra "bash -c" is needed to only export the exported variables. Do +# not use sh - it will add POSIXLY_CORRECT into the environment, which +# is unnecessary. +for VARNAME in $(bash -c 'compgen -v'); do set +u VAL="${!VARNAME}" set -u