From fd7e2ade843457f2c7e63bc4a95b3f02f7e7b060 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 7 Oct 2026 13:46:28 -0300 Subject: [PATCH] fix(xcat-core): nic_cfg.sh backup hides a failed copy of a SUSE ifcfg file The SUSE branch of nic_cfg.sh backup ran one cp over the ifcfg-* glob with "|| :" and stderr sent to /dev/null. That form was needed so a directory with no ifcfg file did not fail the backup, but it also made a real copy failure return 0 with no message. Copy each ifcfg file in a loop. A glob that matches nothing is skipped, and a cp that fails stops the backup with a non-zero exit and the cp error on stderr. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh b/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh index 399998ecd9..8a7e116d11 100755 --- a/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh +++ b/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh @@ -185,7 +185,12 @@ case "$1" in be=$(detect_backend); rm -rf "$BACKUP"; mkdir -p "$BACKUP" || exit 1 case "$be" in nm) if [ -d "$NMDIR" ]; then cp -af "$NMDIR"/. "$BACKUP"/ 2>/dev/null; fi ;; - suse) if [ -d "$SUSEDIR" ]; then cp -af "$SUSEDIR"/ifcfg-* "$BACKUP"/ 2>/dev/null || :; fi ;; + suse) + for f in "$SUSEDIR"/ifcfg-*; do + [ -e "$f" ] || continue + cp -af "$f" "$BACKUP"/ || exit 1 + done + ;; rh) if [ -d "$RHDIR" ]; then cp -af "$RHDIR" "$BACKUP"/ 2>/dev/null; fi ;; ubuntu) if [ -d "$UBUDIR" ]; then cp -af "$UBUDIR"/. "$BACKUP"/ 2>/dev/null; fi ;; esac