Skip to content

install.sh exits 1 after a successful install, and leaves its download directory behind: the exit trap names a local that is gone #958

Closed

Description

@David-Noble-at-work

install.sh's main declares local tmp_dir, then sets trap 'rm -rf "$tmp_dir"' EXIT. The EXIT trap fires after main has returned, when the local no longer exists, and under set -u the expansion fails: install.sh: line 1: tmp_dir: unbound variable, exit status 1. Reproduced 2026-09-26 against the installer the site publishes (develop environment, identical to develop's), in scratch directories: writ installed and answered --version, the script exited 1, and one download directory was left in $TMPDIR.

So every install reports failure to whatever ran it — a provisioning script, CI, a user who checks $? — and leaks the downloaded archive. Reported by the owner the same day.

The cleanup has to see the path after main returns: the path lives at script scope, and the trap calls a function that removes it if set. install.ps1 is not affected: its cleanup is a finally inside Main.

Plan and design documents

Kind Document
Plan docs/plans/fix/958-install-sh-exits-1-after-a.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions