fix(client): install upgrade binaries via install(1), not cp — avoids ETXTBSY #301
No reviewers
Labels
No labels
doctor-fix
first-proof blocker
hardening
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
clawdie/colibri!301
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-upgrade-text-file-busy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the 'Text file busy' (ETXTBSY) bug osa found during the live FreeBSD upgrade test.
Root cause
cmd_upgradeinstalled binaries withsudo cp.cpopens the destinationO_TRUNC— truncating the inode of the currently-runningcolibriclient as it overwrites itself. FreeBSD refuses writes to a busy text (executable) inode → ETXTBSY. Linux tolerates it, which is why it only showed on FreeBSD.Fix
Use
install -m 0755instead ofcp.install(1)writes a temp file in the target dir andrename(2)s it into place. Rename swaps the directory entry; the live process keeps its old mapped inode until it exits. No write to the busy inode → no ETXTBSY. Portable: same behavior on FreeBSD and Linux, and order-independent (no daemon-stop sequencing needed).Supersedes
fix/colibri-text-file-busyThat branch reordered the installs (client before daemon stop). Two problems:
build_diris used before itsletdeclaration (E0425). The green test results were from the already-installed #296 binary, not a build of that branch.cps over itself, socpstill truncates the busy inode regardless of order relative to the daemon stop.Please close
fix/colibri-text-file-busyin favor of this.Gates
cargo fmt --all --checkclean;cargo clippy -p colibri-client --all-targets -- -D warningsclean.Credit: osa found the bug on FreeBSD. Refs #295/#296.
🤖 Generated with Claude Code