Skip to content

install.sh: dsh_banner_probe aborts under set -u on bash 3.2 when timeout is missing (macOS) #382

Description

@opticon454

dsh_banner_probe in install.sh aborts on stock macOS (bash 3.2, no timeout in coreutils) because it expands an array that can be empty under set -u:

dsh_banner_probe() {
local runner=()
ifcommand -v timeout &>/dev/null;then runner=(timeout 5);fi"${runner[@]}""$1" --help </dev/null 2>/dev/null | grep -qi "DeepSeek Harness"
}

install.sh#L650-L656

Repro

On a machine with no timeout binary (stock macOS; GNU coreutils' timeout is what's usually missing there), runner stays the empty array (). install.sh runs under set -euo pipefail, and expanding an empty array under set -u is a runtime abort in bash 3.2 — even with "${runner[@]}", which is the usual safe idiom on bash 4+ but not on 3.2. bash -n install.sh cannot see this: it's a runtime failure, not a syntax error, and only shows up when _cli_candidate_ok reaches the deepseek) dsh_banner_probe "$2" ;; branch — i.e. whenever the installer or its detection path tries to identify a dsh candidate.

Where this was found

Found while working on #380 (CLI catalogue for install.sh + the Docker agent image), which added a real bash:3.2 CI job for the first time. dsh_banner_probe predates that PR and is untouched by it, so it's reported separately rather than folded into that diff.

Suggested fix

Guard the expansion the way the rest of install.sh already does elsewhere for bash-3.2-safe optional arrays — e.g. only expand when non-empty:

dsh_banner_probe() {
local runner=()
ifcommand -v timeout &>/dev/null;then runner=(timeout 5);fiif [[ ${#runner[@]}-gt 0 ]];then"${runner[@]}""$1" --help </dev/null 2>/dev/null | grep -qi "DeepSeek Harness"else"$1" --help </dev/null 2>/dev/null | grep -qi "DeepSeek Harness"fi
}

Happy to send a PR if useful — flagging first since it's unrelated to what #380 touches.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions