Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csplit: incorrect split with --suppress-matched and positive offset #7052

Open
jfinkels opened this issue Jan 2, 2025 · 0 comments
Open

Comments

@jfinkels
Copy link
Collaborator

jfinkels commented Jan 2, 2025

Environment: Ubuntu 20.04, uutils main branch (git commit 6a8b766), GNU coreutils v9.5.227-28b1.

Steps to reproduce:

printf "a\nb\nc\nd\ne\n" | ./target/debug/csplit - --suppress-matched /b/+1

What happens now: with uutils csplit the command outputs:

2
6

and the contents of the two files are

$ cat xx00
a
$ cat xx01
c
d
e

What I expected to happen: with GNU csplit, the command outputs

4
4

and the contents of the two files are

$ cat xx00
a
b
$ cat xx01
d
e

Notes: this is causing a test failure in GNU test file tests/csplit/csplit-suppress-matched.pl.

Also, the current erroneous behavior is enforced by a unit test in tests/by-util/test_csplit.rs named test_up_to_match_offset_option_suppress_matched. That test case will need to be updated as well.

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

No branches or pull requests

1 participant