Repository navigation
fix(install): the lock's two removals ignore one of the same folder at once, which busybox rm fails on - #3909
Conversation
…t once, which busybox rm fails on The holder's sweep of .install.lock.gone-* (#3905) and a releasing run's own rm -rf of its .install.lock.gone-<pid> can remove the same folder together. busybox rm -rf then fails with "No such file or directory" and, under set -e, fails the finished install or the one that just took the lock. Both removals now ignore failure: the rename is the step that matters, and whatever is left is the next holder's to remove. The claim-during-release test bounds its two waits by elapsed time (20 s each) instead of loop turns, and its timeout covers both. docs/development.md says the one-rename release holds for install.sh, while install.ps1 and the plugin's installer keep the narrow race.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Merge passMerged head
Follow-up to #3905, whose review found that the new cleanup of leftover lock folders could fail an install with busybox Left open, not blocking (LOW; needs another user's leftover folder and a reused pid): when a leftover that cannot be removed carries the same pid as the current run, that install finishes its work but exits 1 at release, and the next install breaks the stale lock and passes. On Review reports: ~/.cache/ovis-tmp/reports/ |
What
Follow-up to #3905, from its last review (run at 5ba9332).
A regression #3905 brought in, only where
rmis busybox's. The lock's holder sweeps.install.lock.gone-*as soon as it holds the lock, while the run that just let the lock go is still removing its own
.install.lock.gone-<pid>. With GNUrm -rfthe two removals of one folder never fail. busyboxrm -rflists thefolder, unlinks what is inside, then removes the folder, and it fails on an entry or folder the other process removed
meanwhile:
rm: can't remove '.../.install.lock.gone-<pid>': No such file or directory, exit 1. Underset -e, thatfails either the run whose install had finished (its release) or the run that had just taken the lock (its sweep).
The reviewer saw it once in 1,200 installs at 5ba9332, never before the sweep, and never with GNU rm.
Fix. Both removals ignore failure (
2>/dev/null || true), nothing else. The rename stays the step that matters;neither removal has to succeed, as whatever is left is the next holder's to remove (the sweep #3905 added).
The test's waits. "leaves the lock to a waiter that claims it while the holder removes it" bounded its two waits
by loop turns (3000 x
sleep 0.01), which took 43 s when the review broke the test on purpose, and the two waitscan follow one another, so its 60 s timeout could fire before the named message. Each wait is now bounded by
elapsed time (20 s,
date +%s), the message says 20 s, and the timeout is 90 s.docs/development.md said no race remains for all three installers. It now says
install.shreleases the lock inone rename, while
install.ps1and the plugin's installer still remove it in place and keep the narrow race (astheir own comments say). Neither is changed here.
Test. New, for both sides: "fails no run when the holder's sweep and a release remove the same folder at once,
with an rm that refuses a folder removed meanwhile (busybox)", once with the release inside the folder first and once
with the sweep. An
rmstand-in removes the folder as busybox does (unlinks the pid, then fails with busybox'smessage if the folder went meanwhile); the other run removes it only once the first is inside it, so the two always
meet. The test asserts that they did meet (the stand-in refused), both installs exit 0, bin holds the second's
release, and no
.install.lock*is left.No changelog fragment: the regression never shipped (no tag contains #3905's 4489fbb), and #3905's
install-lock-release-race.mdstill describes what users get.Validation
busybox ash(BusyBox 1.37.0), busybox applets on PATH; run A's ownrm -rf .install.lock.gone-<A>is held bystrace -e inject=rmdir:delay_enter=3safter it unlinked the pid, while B takes the lock and sweepsrm: can't remove '<home>/.install.lock.gone-573045': No such file or directory; B exits 0rm: can't remove '<home>/.install.lock.gone-576433': No such file or directory; A exits 0bun test ./scripts/install-binary.test.ts -t 'remove the same folder at once'(both sides)Expected: 0, Received: 1,rm: can't remove '.../.install.lock.gone-<pid>': No such file or directorytarstand-in never writesfirst-holds), the claim-during-release test and both new casesHERDR_TEST_MODE=unit bun test --rerun-each 30 ./scripts/install-binary.test.tsbun run check fastthroughheavy-run.sh, on 6d001f4sh -n install.shandbusybox ash -n install.sh;bun test ./scripts/conventions.test.ts ./scripts/changelog-fold.test.ts(32 pass).bun run check full, the integration and browser suites (noserver//src/change), the Windows install (install.ps1 unchanged), and macOS (bash 3.2/BSD rm not run).This PR touches
install.sh, so it waits for GitHub's own checks, not only a local merge gate.