From 35f6ed8e78ba26eb6a016f36fe18b5b1e29c9497 Mon Sep 17 00:00:00 2001 From: bigph00t Date: Tue, 2 Jun 2026 13:19:37 -0700 Subject: [PATCH] fix: run install.sh when piped via curl | bash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The entrypoint guard referenced ${BASH_SOURCE[0]} directly while the script runs under `set -euo pipefail`. When invoked as `curl ... | bash`, bash reads from stdin and the BASH_SOURCE array is empty, so `${BASH_SOURCE[0]}` aborts with "unbound variable" before install() ever runs — the documented install path installed nothing. Default BASH_SOURCE[0] to $0 so the guard is both safe under `set -u` and still true when piped: - piped (curl|bash): BASH_SOURCE[0] empty -> defaults to $0 -> install runs - file (bash install.sh): BASH_SOURCE[0] == $0 -> install runs - sourced (tests): BASH_SOURCE[0] != $0 -> install skipped Note: the simpler `${BASH_SOURCE[0]:-}` == `${0:-}` only silences the crash; when piped $0 is "bash" so the comparison is false and install still never runs. Defaulting to $0 is required to actually fix it. Fixes #36 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 81480cf..ea47dec 100755 --- a/install.sh +++ b/install.sh @@ -200,6 +200,6 @@ install() { # Run installation when executed directly. Tests can source this file to exercise # checksum helpers without downloading or installing. -if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then +if [[ "${BASH_SOURCE[0]:-$0}" == "$0" ]]; then install fi