Repository navigation
test(path): pin realpath -s/-L/-P override precedence - #3026
Conversation
The coreutils args sync in #3025 gave `-L` an `overrides_with(strip)` and left `-P` with `overrides_with_all([strip, logical])`, so a trailing `-L`/`-P` now clears `-s` and restores symlink resolution while a trailing `-s` survives them. Nothing pinned that: `path.rs` reads only the `strip` flag and the sole strip test used `-s` alone, so a future `coreutils-args-drift` regen could flip the combination silently. Add a table-driven test over `-s`, `-s -L`, `-L -s`, `-s -P`, `-P -s`, `-L` and `-P`, with expectations taken from GNU coreutils 9.4 on the same layout, and note the override in the `Realpath` doc comment, which previously said only that `-L`/`-P` are equivalent.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | d99cbb4 | Commit Preview URL Branch Preview URL |
Nov 30 2026, 09:31 AM |
Review summary — #3026 (test-only:
|
`no_debug_fmt_in_builtin_source` (TM-INF-022) bars Rust Debug formatting
from `src/builtins`, and the new test's `{args:?}` assertion messages
tripped it in CI. Join the argument slice into a Display label instead of
suppressing the guard with `// debug-ok:`, so the assertion text stays
readable and the invariant keeps its meaning.
What changed
Pins the
realpath-s/-L/-Poverride precedence with a regressiontest, and makes the
Realpathdoc comment say what the combination does.No behaviour change — this is a test plus a doc comment. The behaviour itself
landed in #3025, which regenerated the argument surface from
uutils/coreutils@2a072db29and gave-Lanoverrides_with(strip).Why
Follow-up to the review finding on #3025
(thread).
The sync changed combined-flag behaviour with nothing pinning it:
path.rsreads only the
stripflag and treats-L/-Pas equivalent per L-FS-001,so the only strip coverage was
-son its own(
test_realpath_strip_keeps_symlinks). A futurecoreutils-args-driftregencould drop or flip the override and no test would notice.
The precedence is also asymmetric, which makes it easy to get wrong by
inspection:
-L/-Pdeclare overrides of-s, but-sdeclares none of itsown, so a trailing
-L/-Pclears-swhile a trailing-ssurvives them.I could not write this test before #3025 merged — against the old surface
realpath -s -Lstill stripped, so the test would have encoded the old resultand broken on merge. Hence the separate PR.
Before / After
Expected values were taken from GNU coreutils 9.4
realpathon the samelayout (
/l->/a/b), and bashkit matches on all seven cases:-s /l/./c/l/c-s -L /l/./c/a/b/c-L -s /l/./c/l/c-s -P /l/./c/a/b/c-P -s /l/./c/l/c-L /l/./c/a/b/c-P /l/./c/a/b/cVerified the test actually guards the surface: removing
.overrides_with(OPT_STRIP)fromgenerated/realpath_args.rsmakes it fail,and restoring it makes it pass.
Also confirmed the generated surface is faithful to upstream —
uu_app()at2a072db29declaresoverrides_with(OPT_STRIP)on-Landoverrides_with_all([OPT_STRIP, OPT_LOGICAL])on-P, exactly as generated.Risk
precedence is ever changed deliberately upstream, this test fails and the
expectations need updating with a fresh GNU comparison.
Checklist
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.