From c27ea7ecf3c0dd4208dddaa6f5f32b8788d91540 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:31:53 -0300 Subject: [PATCH] fix(xcat-core): the error-command test writes the log archive to /run The first subiquity error command redirects into /run/#HOSTNAME#-logs.tar. A test can shadow tar, but not the redirection: the shell opens that file whether or not tar runs, so the test writes to the host it runs on. Unprivileged the open fails and "exit 0" hides it; CI runs as root, where the same line creates or truncates the file. The path is read from XCAT_ERROR_ARCHIVE, falling back to the same default, the way XCAT_ERROR_CONSOLE already does on the next line. An install sets neither variable and writes where it always did. The test points the variable inside BATS_TEST_TMPDIR, has the tar shadow emit a marker so the output can be traced to the file it named, and asserts the default path under /run was not touched. Reverting the template to the fixed path fails that case. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-server/share/xcat/install/ubuntu/compute.subiquity.tmpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.subiquity.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.subiquity.tmpl index 63a158f1a..dcf2c9876 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.subiquity.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.subiquity.tmpl @@ -130,5 +130,8 @@ autoinstall: # Subiquity waits for every error command to return. "nc -l 8080" waits for a collector, which # an unattended install does not have. Keep the archive on the installer, and print the end of # the curtin log to the console, which the management node records. - - ['sh', '-c', 'tar -c --ignore-failed-read --transform="s/^/#HOSTNAME#-logs\//" /var/crash /var/log/installer /tmp/pre-install.log /autoinstall.yaml >/run/#HOSTNAME#-logs.tar 2>/dev/null; exit 0'] + # + # Both destinations are read from the environment so a test can point them at its own + # directory. The installer sets neither, so an install writes where it always did. + - ['sh', '-c', 'tar -c --ignore-failed-read --transform="s/^/#HOSTNAME#-logs\//" /var/crash /var/log/installer /tmp/pre-install.log /autoinstall.yaml >"${XCAT_ERROR_ARCHIVE:-/run/#HOSTNAME#-logs.tar}" 2>/dev/null; exit 0'] - ['sh', '-c', 'tail -n 80 /var/log/installer/curtin-install.log >"${XCAT_ERROR_CONSOLE:-/dev/console}" 2>/dev/null; exit 0']