From 8b4402ebcaf268a3e9f182434ecbe433d7a3ceda Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Wed, 8 Jan 2025 17:20:40 +1000 Subject: [PATCH] Fix: "$_" does not expand as expected on Ubuntu While using Ubuntu as default builder nodes. The .bashrc file does not process '$_' expanding the output correctly as provided in previous line. Therefore explicitly use the dirname or use /bin/bash. This results in a copy error. This happens is because by default Ubuntu "/bin/sh" points to "/bin/dash" while on CentOS / RedHat points to "/bin/bash". Issue: RELENG-5666 Change-Id: Ibb4e0daeaf9730464451e229289b687aa2fb5389 Signed-off-by: Anil Belur --- .../fix-ubuntu-dash-shell-issue-36e644c652ce1cd2.yaml | 15 +++++++++++++++ shell/sysstat.sh | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-ubuntu-dash-shell-issue-36e644c652ce1cd2.yaml diff --git a/releasenotes/notes/fix-ubuntu-dash-shell-issue-36e644c652ce1cd2.yaml b/releasenotes/notes/fix-ubuntu-dash-shell-issue-36e644c652ce1cd2.yaml new file mode 100644 index 00000000..caf78251 --- /dev/null +++ b/releasenotes/notes/fix-ubuntu-dash-shell-issue-36e644c652ce1cd2.yaml @@ -0,0 +1,15 @@ +--- +issues: + - | + "$_" does not expand as expected on Ubuntu + + While using Ubuntu as default builder nodes. + The .bashrc file does not process '$_' expanding + the output correctly as provided in previous line. + Therefore explicitly use the dirname or use /bin/bash. + + This results in an copy error. + + This happens is because by default Ubuntu "/bin/sh" + points to "/bin/dash" while on CentOS / RedHat points to + "/bin/bash". diff --git a/shell/sysstat.sh b/shell/sysstat.sh index eada1b35..447408c5 100644 --- a/shell/sysstat.sh +++ b/shell/sysstat.sh @@ -50,7 +50,7 @@ esac SAR_DIR="$WORKSPACE/archives/sar-reports" mkdir -p "$SAR_DIR" -cp "$SYSSTAT_PATH/"* "$_" +cp "$SYSSTAT_PATH/"* "$SAR_DIR" # convert sar data to ascii format while IFS="" read -r sarfilenum; do [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}" -- 2.16.6