You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
grep - interval counts above 32767 are accepted; GNU rejects them with Regular expression too big #208
GNU grep accepts interval counts up to 32767 and rejects anything larger, in BRE and ERE and
for either bound, with Regular expression too big and exit 2 (observed with GNU grep 3.12: k{32767} compiles, k{32768} does not). uu_grep passes the interval to Oniguruma, whose
own limit is 100000 (ONIG_MAX_REPEAT_NUM), so k{40000} and k{1,40000} are searched
and exit 0/1.
Exposed by the GNU test bre (Spencer BRE test #44, a\{32768\} must exit 2).
$ printf'kk\n'| LC_ALL=C /usr/bin/grep -E 'k{40000}'
/usr/bin/grep: Regular expression too big
# Exit code: 2
$ printf'kk\n'| LC_ALL=C /usr/bin/grep 'k\{40000\}'
/usr/bin/grep: Regular expression too big
# Exit code: 2
$ printf'kk\n'| LC_ALL=C /usr/bin/grep -E 'k{1,40000}'
/usr/bin/grep: Regular expression too big
# Exit code: 2
Test
#[test]fninterval_count_limit(){for args in[&["-E","w{32800}"][..],&["w\\{2,50000\\}"][..],&["-E","w{,32768}"][..],]{let(_s,mut c) = ucmd();
c.args(args).pipe_in("ww\n").fails_with_code(2).no_stdout().stderr_contains("Regular expression too big");}// The largest accepted count still works.let(_s,mut c) = ucmd();
c.args(&["-E","-c","w{32767}"]).pipe_in("ww\n").fails_with_code(1).stdout_only("0\n");}
Activity