Skip to content

bug(csplit): some regexes, leads to a successfull match and valid regexes treated as invalid regexes #13120

Description

@HackingRepo

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$ 

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions