coreutils/src
naoNao89 1afeb7a6e3 csplit: create final empty file with --suppress-matched to match GNU (fixes #7286)
Problem
- With , uutils csplit failed to create the final empty output file when the last split point consumed the trailing input.
- GNU csplit always creates a final segment after processing patterns; with , that empty final segment is elided.
- This broke the GNU test (tests/csplit/csplit-suppress-matched.pl) and the scenario:

Root cause
- Final-file creation was conditional on there being remaining input after pattern processing. If none remained, no final file was created, contrary to GNU semantics.

Fix (minimal, targeted)
- In , after :
  - If there is remaining input, always create a final split and copy the remainder, then finish.
  - Else, if all patterns were integer-based and  is set, create a final (possibly empty) split and finish;  elides it when  is set.

Tests (Rust integration)
- Added two Rust tests under  to lock down GNU-compatible behavior:
  -  (expects sizes 2,2,2,0 and a final empty )
  -  (final empty file is correctly elided)

Verification
- All  tests pass locally. The originally reported case now matches GNU.

Relation to PR #7806
- #7806 proposes a broader refactor to fix multiple issues, but remains a draft and notes remaining GNU suppress-matched differences.
- This PR provides a small, reviewable fix specifically for #7286, plus precise integration tests to safeguard behavior.

Fixes #7286
2025-09-18 00:29:55 +07:00
..
bin Fix the doc generation and remove uuhelp_parser 2025-09-11 21:30:33 +02:00
uu csplit: create final empty file with --suppress-matched to match GNU (fixes #7286) 2025-09-18 00:29:55 +07:00
uucore Merge pull request #8645 from cakebaker/uucore_checksum_simplify_create_sha3 2025-09-16 22:12:36 +02:00
uucore_procs Fix the doc generation and remove uuhelp_parser 2025-09-11 21:30:33 +02:00