Repository navigation
fix(ln): -i/-f follow last-wins order (Refs #1651) - #1662
Conversation
GNU ln.c:505-512 assigns both flags on each option (-f sets remove_existing_files and clears interactive; -i clears remove_existing_files and sets interactive), so the last of the pair governs. The port set each flag independently and checked interactive first, so -i always won. Mirror the GNU pair in the long and short parsers; clusters already walk in order (-if forces, -fi prompts). Regression nail: interactive_force_last_wins (8 cells, oracle shapes).
Captain review: PASSReviewer: read-only review (dossier Mechanism — PASS. GNU coreutils 9.4 Pins — PASS. Oracle re-run by the reviewer: all 8 cells match (rc / b-content / prompt). CI job log (not just the green check), job 132393993745: CI — one red job, dispositioned by the captain (F1, waived). Run 43577222551: 7 pass (build-windows ×4, rust-tests, rust2-surface-check, i18n-drift), 4 skipping, Fail-first — owed, not blocking (F2). Not banked: X299 has no direct GitHub route and the server-side clone crawled (~3–35 KB/s); box disk is full. The reviewer's X299 attempt produced only a VOID PowerShell command-not-found (no driver was ever built). Accepted as non-blocking: the oracle table is 8/8, the nail is proven to have run green on head, and the base behavior is the reported bug itself (issue repro). Bank opportunistically later from the server leftovers ( Hygiene — PASS. Intersection — ∅, merge without update-branch. Merge-base 35f4864; live tip 7a0873c (PR #1664, childproc shebang, merged 17:48). Interval files: Merge notes. #1651 stays open mechanically (Refs only); the fix fully resolves the reported case, so the captain will close #1651 manually after merge. Adjacent |
fix(ln): -i/-f follow last-wins order (Refs #1651)
Summary
GNU ln processes -i/-f in argv order, last wins (ln.c:505-512: -f sets remove_existing_files and clears interactive; -i clears remove_existing_files and sets interactive). The port set each flag independently and checked interactive first, so -i always won:
ln -i -f a bprompted and refused on 'n' (rc 1) where GNU forces (rc 0).Fix mirrors the GNU flag pair in both the long-option and short-option parsers of rust2/crates/winux-cmds/src/ln.rs. Short clusters already walk char by char in order, so -if forces and -fi prompts with no extra code. remove_existing() is untouched: with GNU-mirrored flags its prompt-first/force/Refused branches already implement the order.
GNU semantics
coreutils 9.4 src/ln.c:488 (both flags default false), :505-512 (the pair), :213 (force = remove_existing_files || interactive || backup), :275 (prompt iff interactive, decline on no).
Verification
What this PR deletes
None. No code paths removed; only the -i/-f flag-assignment semantics changed.
Refs #1651