bug-grep
[Top][All Lists]
Advanced

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

[bug #29394] Incorrect matches with grep -w


From: anonymous
Subject: [bug #29394] Incorrect matches with grep -w
Date: Wed, 31 Mar 2010 12:30:48 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9

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/





reply via email to

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