Root cause: silent() (core.func) unconditionally calls set -Eeuo pipefail
and trap 'error_handler' ERR after every command. When build_container()
intentionally disables error handling for its recovery section, any
intermediate call through silent()/ re-enables it. This causes the
grep/sed pipeline for missing_cmd extraction to trigger error_handler
(grep returns exit code 1 on no match + pipefail = fatal).
Fixes:
1. silent(): Save errexit state before disabling, only restore if it was
active. Callers that intentionally disabled error handling (e.g.
build_container recovery) are no longer silently re-enabled.
2. build.func: Add || true to missing_cmd grep pipeline as defense-in-depth
against pipeline failure propagation.
3. build.func: Add explicit set +Eeuo pipefail / trap - ERR after
post_update_to_api() call, before error classification grep/sed section.
4. build.func: Remove stale global combined_log variable from variables()
that used a different path format (/tmp/install-SESSION-combined.log)
than the actual local variable (/tmp/NSAPP-CTID-SESSION.log). The global
was never written to and caused confusion when error_handler displayed it.
2026-02-24 13:51:27 +01:00
2 changed files with 34 additions and 15 deletions
NSAPP=$(echo"${APP,,}"| tr -d ' ')# This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces.
var_install="${NSAPP}-install"# sets the var_install variable by appending "-install" to the value of NSAPP.
INTEGER='^[0-9]+([.][0-9]+)?$'# it defines the INTEGER regular expression pattern.
PVEHOST_NAME=$(hostname)# gets the Proxmox Hostname and sets it to Uppercase
DIAGNOSTICS="no"# Safe default: no telemetry until user consents via diagnostics_check()
METHOD="default"# sets the METHOD variable to "default", used for the API call.
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)"# generates a random UUID and sets it to the RANDOM_UUID variable.
EXECUTION_ID="${RANDOM_UUID}"# Unique execution ID for telemetry record identification (unique-indexed in PocketBase)
SESSION_ID="${RANDOM_UUID:0:8}"# Short session ID (first 8 chars of UUID) for log files
combined_log="/tmp/install-${SESSION_ID}-combined.log"# Combined log (build + install) for failed installations
NSAPP=$(echo"${APP,,}"| tr -d ' ')# This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces.
var_install="${NSAPP}-install"# sets the var_install variable by appending "-install" to the value of NSAPP.
INTEGER='^[0-9]+([.][0-9]+)?$'# it defines the INTEGER regular expression pattern.
PVEHOST_NAME=$(hostname)# gets the Proxmox Hostname and sets it to Uppercase
DIAGNOSTICS="no"# Safe default: no telemetry until user consents via diagnostics_check()
METHOD="default"# sets the METHOD variable to "default", used for the API call.
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)"# generates a random UUID and sets it to the RANDOM_UUID variable.
EXECUTION_ID="${RANDOM_UUID}"# Unique execution ID for telemetry record identification (unique-indexed in PocketBase)
SESSION_ID="${RANDOM_UUID:0:8}"# Short session ID (first 8 chars of UUID) for log files
# Save current error handling state before disabling
# This prevents re-enabling error handling when the caller intentionally
# disabled it (e.g. build_container recovery section)
local_restore_errexit=false
[["$-"== *e* ]]&&_restore_errexit=true
set +Eeuo pipefail
trap - ERR
"$@" >>"$logfile" 2>&1
localrc=$?
set -Eeuo pipefail
trap'error_handler' ERR
# Restore error handling ONLY if it was active before this call
if$_restore_errexit;then
set -Eeuo pipefail
trap'error_handler' ERR
fi
if[[$rc -ne 0]];then
# Source explain_exit_code if needed
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.