URL:
<http://savannah.gnu.org/bugs/?29394>
Summary: Incorrect matches with grep -w
Project: grep
Submitted by: None
Submitted on: Wed 31 Mar 2010 12:30:47 PM UTC
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
In some situations, grep (and egrep) return incorrect results when the -w
option is used. Example:
$ cat bug
/ABC/
x
/ABCD/
/ABCD/
$ grep -w ABC bug
/ABC/
/ABCD/
$ LC_CTYPE=C grep -w ABC bug
/ABC/
The incorrect second match only occurs when the preceding line is exactly 1
character long. With LC_CTYPE=C, the problem disappears.
$ grep --version
GNU grep 2.5.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ locale
LANG=
LC_CTYPE=en_US.utf8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE=POSIX
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29394>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/