coreutils/tests
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
..
benches/factor chore: cleanup unused dependencies 2025-07-02 19:47:23 -04:00
by-util csplit: create final empty file with --suppress-matched to match GNU (fixes #7286) 2025-09-18 00:29:55 +07:00
fixtures test(sort): Fix fixtures 2025-07-25 13:51:53 +02:00
uutests who: honor locale settings 2025-09-01 22:36:54 +08:00
test_localization_and_colors.rs clap/locale: fix the colors for all programs (Closes: #8501) 2025-09-05 08:25:59 +02:00
test_util_name.rs link musl libc statically 2025-09-09 12:53:32 +02:00
tests.rs uutests: fix the doc 2025-03-29 09:28:54 +01:00