bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep 2.5.1: NUL byte doesn't match a complemented character class


From: Joe Wells
Subject: grep 2.5.1: NUL byte doesn't match a complemented character class
Date: Mon, 20 Aug 2007 04:02:56 +0100

In grep 2.5.1, a NUL character doesn't match a complemented character
class.

To reproduce:

1. Run the command “grep '[^x]x'”

2. Type the line consisting of the NUL character (the single byte with
   all bits off) followed by “x”.  How to do this depends on your tty
   settings and your terminal.  In my gnome-terminal I can do this by
   typing these keys: Control-V Control-2 x Return.  (Yes, I really
   mean Control-2.)

3. Observe that grep doesn't output anything, despite the fact that
   NUL is distinct from “x” and hence should match “[^x]”.  (A
   separate test reveals that NUL does match the pattern “.”, so
   clearly grep is seeing the character and can pass it through if it
   thinks it matches the pattern.)

Hopefully this bug has been fixed since version 2.5.1 was released,
but just in case I report it.

-- 
Joe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]