fix(update): make downloaded binaries executable (self-update apply on Unix)#452
Merged
Merged
Conversation
…n Unix) `uffs --update apply` failed on macOS/Linux with "smoke test failed for uffs; rolled back": apply swaps each binary in, then runs `<bin> --version` to verify it before committing — but acquired binaries were written by the HTTP download at the default 0644 (not executable), so `uffs --version` got permission-denied and the apply rolled back. (Previously masked by the quiesce failure that aborted before smoke; with no daemon to stop, apply reached smoke and exposed it. `just use` is unaffected — its tarball keeps +x.) Fix: chmod the staged binary to 0755 right after its SHA-256 verifies, in the acquire loop. Unix-only; Windows ignores file mode (no-op stub). `make_executable` helper + unit test asserting a seeded-0644 file gains the exec bit. Host + Windows-MSVC clippy clean; uffs-update tests pass (46). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uffs --update applyfails on macOS/Linux with "smoke test failed for uffs; rolled back" — and it has never worked on Unix.Root cause
Apply does
backup → swap → smoke → commit, where the smoke test runs the just-swapped binary (<bin> --version,SMOKE_ARG) to prove it works before committing. But acquired binaries are written by the HTTP download (github::download_to→File::create) at the default0644— not executable. Souffs --versiongets permission denied, smoke fails, and the whole apply rolls back.It was masked until now: the earlier quiesce failure (daemon stop) aborted before the smoke phase ever ran. With no daemon to stop, apply reached smoke and exposed it. (
just useis unaffected — its release tarball preserves+x.)Fix
chmod 0755on each staged binary immediately after its SHA-256 verifies, in the acquire loop. Unix-only; Windows ignores file mode (no-opconst fnstub mirroring the signature so the?call site compiles everywhere). Split into amake_executablehelper with a unit test that seeds a0644file and asserts the exec bit is set.Verification
make_executable_sets_the_exec_bits.Note: because the broken helper ships in every release so far (incl. 0.6.7), Unix users must
just use(tarball) to update until a release carries this fix — after whichuffs --update/applywork on macOS/Linux too.🤖 Generated with Claude Code