From 2edd2ffaf8ce31b96a4303e8712ea4cfb459f9d8 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Mon, 16 Feb 2026 08:51:05 +0100 Subject: [PATCH] fix: remove duplicate error handler from alpine-install.func (#11971) - Remove legacy error_handler(), on_exit(), on_interrupt(), on_terminate() and set/trap definitions from alpine-install.func (already provided by error_handler.func which is sourced on line 10) - The local error_handler() expected positional args as required, but catch_errors() sets trap as 'error_handler' (without args), causing unbound variable error with set -u (nounset) - error_handler.func uses default values which is set -u safe - Also align legacy trap in install.func network_check() to standard format Fixes #11929 --- misc/alpine-install.func | 36 ------------------------------------ misc/install.func | 2 +- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/misc/alpine-install.func b/misc/alpine-install.func index 3e23ba540..537a3148e 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -34,42 +34,6 @@ EOF fi } -set -Eeuo pipefail -trap 'error_handler $? $LINENO "$BASH_COMMAND"' ERR -trap on_exit EXIT -trap on_interrupt INT -trap on_terminate TERM - -error_handler() { - local exit_code="$1" - local line_number="$2" - local command="$3" - - if [[ "$exit_code" -eq 0 ]]; then - return 0 - fi - - printf "\e[?25h" - echo -e "\n${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}\n" - exit "$exit_code" -} - -on_exit() { - local exit_code="$?" - [[ -n "${lockfile:-}" && -e "$lockfile" ]] && rm -f "$lockfile" - exit "$exit_code" -} - -on_interrupt() { - echo -e "\n${RD}Interrupted by user (SIGINT)${CL}" - exit 130 -} - -on_terminate() { - echo -e "\n${RD}Terminated by signal (SIGTERM)${CL}" - exit 143 -} - # This function sets up the Container OS by generating the locale, setting the timezone, and checking the network connection setting_up_container() { msg_info "Setting up Container OS" diff --git a/misc/install.func b/misc/install.func index b8a09a8b8..5a8d10d0b 100644 --- a/misc/install.func +++ b/misc/install.func @@ -172,7 +172,7 @@ network_check() { fi set -e - trap 'error_handler $LINENO "$BASH_COMMAND"' ERR + trap 'error_handler' ERR } # ==============================================================================