bug(csplit): some regexes, leads to a successfull match and valid regexes treated as invalid regexes
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Hi, uutils mainteners
to reproduce that, we need first have an a file by example with that content
relunsec@relunsec:~/software/coreutils/target/debug$ cat a
hello
relunsec@relunsec:~/software/coreutils/target/debug$
it can be whatever, but just contains the h ascii char and then
we did
relunsec@relunsec:~/software/coreutils/target/debug$ sudo gnucsplit -b '%.d' a '/^^h/'
gnucsplit: ‘/^^h/’: match not found
6
relunsec@relunsec:~/software/coreutils/target/debug$ ls xx*
ls: cannot access 'xx*': No such file or directory
relunsec@relunsec:~/software/coreutils/target/debug$ sudo ./csplit -b '%.d' a '/^^h/'
0
6
relunsec@relunsec:~/software/coreutils/target/debug$ ls xx*
xx0 xx1
the gnu csplit say '/^^h/' no match however, the uu csplit one sees a match
it also with
relunsec@relunsec:~/software/coreutils/target/debug$ sudo ./csplit -b '%.d' a '/^?[a-z]/'
0
6
relunsec@relunsec:~/software/coreutils/target/debug$ sudo gnucsplit -b '%.d' a '/^?[a-z]/'
gnucsplit: ‘/^?[a-z]/’: match not found
6
relunsec@relunsec:~/software/coreutils/target/debug$
and valid regexes by uu treated as invalid, there a completly valid in standard
relunsec@relunsec:~/software/coreutils/target/debug$ cat a
[]
relunsec@relunsec:~/software/coreutils/target/debug$ sudo ./csplit -b '%.d' a '/^[[]]/'
csplit: '/^[[]]/': invalid pattern
relunsec@relunsec:~/software/coreutils/target/debug$ sudo gnucsplit -b '%.d' a '/^[[]]/'
0
3
relunsec@relunsec:~/software/coreutils/target/debug$
or just with
relunsec@relunsec:~/software/coreutils/target/debug$ sudo ./csplit -b '%.d' a '/^+/'
0
6
relunsec@relunsec:~/software/coreutils/target/debug$ sudo gnucsplit -b '%.d' a '/^+/'
gnucsplit: ‘/^+/’: match not found
6
relunsec@relunsec:~/software/coreutils/target/debug$
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reported csplit commands against the sample files and compare their results with GNU csplit. Trace the csplit implementation and its regular-expression handling, then ensure the shown patterns produce the same match or invalid-pattern behavior as GNU csplit and rerun all three reproductions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100