Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 574662 - sys-apps/grep-2.23: -z option breaks character ranges
Summary: sys-apps/grep-2.23: -z option breaks character ranges
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://debbugs.gnu.org/cgi/bugreport....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-13 22:53 UTC by Ulrich Müller
Modified: 2016-03-11 21:17 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info sys-apps/grep (emerge-info,6.51 KB, text/plain)
2016-02-13 22:54 UTC, Ulrich Müller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2016-02-13 22:53:45 UTC
According to the documentation, option -z or --null-data should cause grep to treat newlines as ordinary data. Therefore, in the following example the regexp ^[1-4]$ should _not_ match the input data:

$ printf '12\n34\0' | LC_ALL=en_US.utf8 grep -z -e '^[1-4]*$' | od -t x1
0000000 31 32 0a 33 34 00
0000006

Spelling it out as [1234] makes it work as expected:

$ printf '12\n34\0' | LC_ALL=en_US.utf8 grep -z -e '^[1234]*$' | od -t x1
0000000

It is also locale dependent, I see the problem with LC_ALL=en_US.utf8 and LC_ALL=en_US, but not with LC_ALL=C.
Comment 1 Ulrich Müller gentoo-dev 2016-02-13 22:54:22 UTC
Created attachment 425428 [details]
emerge --info sys-apps/grep
Comment 2 Ulrich Müller gentoo-dev 2016-03-11 20:25:32 UTC
sys-apps/grep-2.24 fixes the problem for me.
Can this bug be closed?
Comment 3 SpanKY gentoo-dev 2016-03-11 21:17:44 UTC
sgtm!