From 416ea5dcce60a115a77a347611141a722cba5c92 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 13 Jul 2026 15:01:16 +0200 Subject: image-builder: fix false GPG-update warning from SIGPIPE on yes pipe bootstrap fed slackpkg update gpg with "yes YES |". When slackpkg exits first (key already valid), yes takes SIGPIPE and, under set -e/pipefail, the pipeline reports non-zero even though the key import succeeded, firing a bogus "slackpkg GPG update failed" warning on every run. Read slackpkg own status via PIPESTATUS[1] instead of the pipeline status, inside an if so set -e/pipefail does not abort on the SIGPIPE; capture PIPESTATUS as the first command in each branch so no intervening command resets it. Verified: warning gone on re-run, key still imports. Co-Authored-By: Claude Opus 4.8 --- .extras/image-builder/bootstrap.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.extras/image-builder/bootstrap.sh b/.extras/image-builder/bootstrap.sh index 0698d55..ff766d1 100755 --- a/.extras/image-builder/bootstrap.sh +++ b/.extras/image-builder/bootstrap.sh @@ -446,7 +446,15 @@ FSTAB # as a safety net; with the CA database now valid the prompt should not # appear because the download succeeds on the first attempt. _log "Importing Slackware GPG key via slackpkg..." - yes YES | chroot "${ROOTFS}" /usr/sbin/slackpkg -batch=on -default_answer=y update gpg || _warn "slackpkg GPG update failed; check the output above." + # Check slackpkg's own exit status, not the pipeline's: 'yes' takes SIGPIPE + # when slackpkg exits first, which can make the pipeline non-zero even on + # success (false "GPG update failed" warning). Wrapping in 'if' exempts the + # pipeline from set -e/pipefail so we can read PIPESTATUS[1] (slackpkg's own + # status) instead of the SIGPIPE-poisoned pipeline status. + local gpg_rc + if yes YES | chroot "${ROOTFS}" /usr/sbin/slackpkg -batch=on -default_answer=y update gpg + then gpg_rc="${PIPESTATUS[1]}"; else gpg_rc="${PIPESTATUS[1]}"; fi + [[ "${gpg_rc}" -eq 0 ]] || _warn "slackpkg GPG update failed; check the output above." _log "Updating slackpkg package list..." chroot "${ROOTFS}" /usr/sbin/slackpkg -batch=on -default_answer=y update || _warn "slackpkg update failed; cache will build on first container run." -- cgit v1.2.3