uninstall_confirm swallows Ctrl-D: the abort is silent, while db.sh one file away gets it right #68
Labels
No labels
attention
blocked
blocker:ci-red
blocker:conflict
blocker:drill-pending
blocker:unrequested
bug
claimed
documentation
enhancement
epic
merge-next
needs-ruling
needs-triage
offsite
post-merge
ready
release
scope:bootstrap
scope:coolify
scope:db
scope:docs
scope:drill
scope:installer
scope:labels
scope:platform
scope:runner
scope:users
stale
state:addressing
state:bots-reviewing
state:building
state:needs-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: heavy-duty/rig#68
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found while fixing the identical defect in box (
heavy-duty/box#111/ PRheavy-duty/box#112), reading rig to match its house style. Filing it here rather than leaving it in a box PR body.The defect
uninstall_confirm()atbin/rig:240reads the operator's answer unguarded:Ctrl-D at the prompt makes
readreturn non-zero. Underset -euo pipefailthe function dies there — thecaseis never evaluated, sodie "aborted."never fires. The operator sees the question, presses Ctrl-D, and gets nothing: no confirmation the uninstall was aborted, no message, just exit 1.rig already has the cure, one file away
This is the part that makes it worth fixing rather than tolerating.
commands/db.sh:152handles the same shape correctly:Same y/N confirm shape, same
set -euo pipefailcontext, and it falls through to thedieon EOF exactly as intended. So rig is internally inconsistent: the destructive database restore says "aborted" on Ctrl-D, and the destructive uninstall says nothing.#43cured this class for rig's four hidden-rsptoken prompts using|| { echo; die … }. Between that anddb.sh, rig has now solved this twice —uninstall_confirmis simply the site that neither pass reached.Severity: low, and honest about it
It fails closed. Nothing is uninstalled; the abort is real. The damage is purely that the tool goes silent at the exact moment it asked a question, which is the worst possible moment to say nothing — an operator who Ctrl-Ds out of
rig uninstallcannot tell from the output whether anything was removed.It is also not a regression; this has been the shape since
uninstall_confirmwas written.The fix
One token, matching whichever sibling you prefer:
bin/rig:240—read -r reply || reply=""(matchesdb.sh:152, the closer sibling — same confirm shape), orread -r reply || die "aborted."(matches what box#112 used)Observable behavior is identical either way: exit 1 with the abort message on the prompt line. Worth picking one spelling and using it in both repos so this stops being re-litigated per site.
Testing note
The interactive accept/abort paths are currently untested here, structurally — they need a pty, which is exactly why this survived. box#112 built one: six checks in
test/cli.shdrivingy,nand Ctrl-D through util-linuxscriptagainst the fake shim, guarded by acommand -v scriptskip. Two details from that work worth copying if this gets a test:bin/boxgives473 passed, 1 failedonoutput missing 'aborted.'and fixed gives474 passed, 0 failed. A test that has not been shown to fail against the bug is not evidence.A test is not required for a one-token fix, but if one is written, it should be that one.
Refs
heavy-duty/box#111(the same defect in box) ·heavy-duty/box#112(the fix, with the pty harness) · #43 (the same class, cured for rig's token prompts) ·commands/db.sh:152(rig's own correct handling)