Repository navigation
fix(true,false,dirname): coreutils operand-ignore and leading-slash collapse semantics (#1196) - #1198
Merged
Merged
Conversation
…ollapse semantics (#1196)
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
…uite - dirname: revert the #1337 all-separator collapse. On this platform // is the MSYS/UNC root and is deliberately preserved (#1196/#1198 tests encode it); the audit compared against Linux GNU where // is not a distinct root. Issue #1337 stays open as a platform-intentional divergence; regression case 61 and its index row are dropped. - stat test: GNU keeps an explicit -c format regardless of a later -t (probed in #1334); the inherited test asserted the opposite. - tail test: with -z, GNU keeps headers and section separators newline-terminated (probed in #1342); the inherited test encoded the pre-fix NUL form. Verified on the rebased base (beb5655): MSVC Debug build green; 98/98 touched-area tests pass; full ctest retains only the 11 environmental failures that reproduce identically on origin/main (LongPathsEnabled=0, no CONIN$ console under the test runner). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1196 (the agent that implemented this finished its worktree silently; I verified every claim below before landing it).
What changed
src/commands/true.cpp/src/commands/false.cpp: the handlers no longer run getopt on operands — coreutils'true/falseignore anything that is not the sole--help/--version.true -xandtrue fixed-argsexit 0 (installed build returned 1).src/core/dispatcher.cppm:true/falsejoin the existinghelp_version_only_when_sole_argumentbehavior class shared withprintf/test/[— so--helpas the sole argument still prints help through the shared (i18n-cataloged) path, and it stops being data in any other position. No new user-visible strings; a hardcoded English usage block was removed fromtrue.cpp(AGENTS.md I18N review satisfied: net-zero / net-negative).src/commands/dirname.cpp: GNU separator semantics — trailing slash trimming relative to the root prefix, with one-or-two leading slashes preserved and three-or-more collapsed (dirname //→//,dirname ///→/,dirname ////a→/).basename ''etc. via the shared operand guard.Verification (this worktree, fresh build)
powershell scripts/build-with-vs.ps1→ 803/803 compiled and linked clean.ctest -R "true_cmd|false_cmd"→ 10/10 pass (true_basic,true_ignores_nonempty_operand,true_ignores_every_operand_silently,true_help_only_as_sole_argument, false side mirrored).ctest -R "dirname\."→ 14/14 pass (incl. newdirname_triple_slash_collapses_to_single,dirname_four_slash_collapses_to_single,dirname_double_slash_root_*,dirname_unc_paths_preserve_double_separator_root).D:/Git/usr/bincoreutils:true -x→ rc 0 (GNU 0),dirname ///→/(GNU/),dirname //→//(GNU//),dirname /a/b/c→/a/b.--helpexit status convention follows WinuxCmd's house rule (0), matching what the shared help mechanism already does for printf/test.Scope
No other tools touched;
command_context.cppmonly carries the plumbing for the operand-guard. This closes both halves of #1196; the sibling issue #1195 (checksum text-mode stdin) is being handled separately.