Skip to content

fix!: installer follow-ups from the 0.2.0 review - #13

Merged
bfirestone merged 3 commits into
mainfrom
fix/installer-followups
Sep 9, 2026
Merged

bfirestone merged 3 commits into
mainfrom
fix/installer-followups

Conversation

@bfirestone

@bfirestone bfirestone commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Three follow-ups from the 0.2.0 code review, one commit each.

replaceFile used to move the target to .old before renaming .new over it. A crash between those two renames left no binary at all, and the missing file is the one that would run the next update. It now does a single rename(2) of .new over the target, which is atomic on Linux and macOS and works on a running executable. RollbackError is unreachable and removed. No caller used it, hence the fix!.

DefaultManagedInstalls anchors the Homebrew pattern on the formula and version segments, so a project directory named Cellar is no longer refused. The dpkg/rpm pattern adds /usr/sbin, /usr/lib64 and /usr/libexec.

ArchiveInstaller builds its default HTTP client once at package level instead of writing to the struct, and caps the download at the declared asset size.

Verify with go test -race -count=1 ./... and golangci-lint run ./....

Closes goselfupda-1cc5.04rmyj, goselfupda-1cc5.03wl6k, goselfupda-1cc5.0043vw.

@bfirestone

Copy link
Copy Markdown
Contributor Author

This change is part of the following stack:

Change managed by git-spice.

An unanchored /Cellar/ refused any path with a directory of that name, and dpkg and rpm also own /usr/sbin, /usr/lib64 and /usr/libexec. The Cellar pattern requires the formula and version segments and nothing below them, so sbin and libexec installs stay refused.
Moving the target to .old first opened a two-syscall window in which a crash left no binary at all. The next update then could not even start, since the missing file is the one that runs it. rename(2) replaces a running executable atomically on Linux and macOS, so the .old step is gone and RollbackError is removed with it.

BREAKING CHANGE: RollbackError is removed. No caller used it.
client() used to assign the lazily built default to the exported field, which raced when one installer served several goroutines. The download also had no size bound, so a hostile payload could fill the temp dir before the checksum rejected it.
@bfirestone
bfirestone force-pushed the fix/installer-followups branch from 212f242 to 3a6a2f5 Compare September 9, 2026 03:22
@bfirestone bfirestone changed the title fix: installer follow-ups from the 0.2.0 review fix!: installer follow-ups from the 0.2.0 review Sep 9, 2026
@bfirestone
bfirestone merged commit aecd58f into main Sep 9, 2026
3 checks passed
@bfirestone
bfirestone deleted the fix/installer-followups branch September 9, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant