Skip to content

csplit: accept a hyphen-leading --suffix-format value - #14320

Merged
cakebaker merged 1 commit into
uutils:mainfrom
arbelonson-source:fix/csplit-suffix-format-hyphen-value
Aug 31, 2026
Merged

csplit: accept a hyphen-leading --suffix-format value#14320
cakebaker merged 1 commit into
uutils:mainfrom
arbelonson-source:fix/csplit-suffix-format-hyphen-value

Conversation

@arbelonson-source

Copy link
Copy Markdown
Contributor

What

--suffix-format's value was rejected as an unrecognized flag when
given as its own argument:

$ csplit --suffix-format -%02d f /pat/

# GNU: accepts it, splits normally with files named xx-00, xx-01, ...
# uutils, before this PR:
error: unexpected argument '-%' found
  tip: to pass '-%' as a value, use '-- -%'

The attached forms (-b-%02d, --suffix-format=-%02d) already
worked; only the separate-argument form broke -- the same
allow_hyphen_values gap already fixed this session for several other
options (sort --parallel, nl's numeric options, ptx --gap-size/--width, join -t).

Testing

  • cargo test -p uu_csplit / full tests/by-util/test_csplit.rs suite: 93 passed, 0 failed.
  • Added a regression test for the separate-argument hyphen-leading case, checking both stdout and the actual split filenames produced.
  • Manually diffed --suffix-format -%02d and --suffix-format=z%02d (both output and the resulting filenames) against GNU csplit 9.11 under LC_ALL=C.
  • cargo clippy -p uu_csplit --all-targets -- -D warnings and cargo fmt --check: clean.

This PR was written with AI assistance (Claude Opus 5, via Claude Code). I've tested the changes but please review the code carefully.

--suffix-format's value was rejected as an unrecognized flag when
given as its own argument (csplit --suffix-format -%02d f /pat/, not
the attached -b-%02d or --suffix-format=-%02d): the Arg was missing
allow_hyphen_values, the same gap already fixed this session for
several other options (sort --parallel, nl's numeric options, ptx
--gap-size/--width, join -t). GNU's own --suffix-format accepts any
argument as the format string regardless of its first character.

AI-assisted-by: Claude Opus 5, via Claude Code
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (was skipped on 'main', now failing)

@cakebaker
cakebaker merged commit 982ac4d into uutils:main Aug 31, 2026
103 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants