Bug 179698 - grep -w broken in multibyte locales
grep -w broken in multibyte locales
Product: Fedora
Classification: Fedora
Component: grep (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Mike McLean
Depends On:
Blocks: 574350
  Show dependency treegraph
Reported: 2006-02-01 23:53 EST by Tim Robbins
Modified: 2010-03-17 06:32 EDT (History)
0 users

See Also:
Fixed In Version: 2.5.1-53
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 574350 (view as bug list)
Last Closed: 2006-02-20 09:51:45 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Potential fix for grep -w problem (2.16 KB, patch)
2006-02-19 17:52 EST, Tim Robbins
no flags Details | Diff

  None (edit)
Description Tim Robbins 2006-02-01 23:53:43 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8

Description of problem:
grep -w appears not to work for any non-UTF-8 multibyte locale; matches are often not reported when 
they should be.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
echo za a | LANG=ja_JP.eucjp grep -w a

Actual Results:  No output.

Expected Results:  Output: "za a".

Additional info:

The command gives the expected output on FC3.
Comment 1 Tim Waugh 2006-02-03 12:26:02 EST
Thanks for the report.


* this is for non-UTF-8 multibyte locales.  UTF-8 input works correctly.
* FC-3 gives the same output for me (grep-2.5.1-31.4).
Comment 2 Tim Robbins 2006-02-19 17:52:40 EST
Created attachment 124869 [details]
Potential fix for grep -w problem

This is a potential fix for the grep -w problem in non-UTF-8 multibyte locales.
It attempts to correctly locate the multibyte character preceeding the matched
string by (slowly) scanning forward from the start of the buffer until it
reaches the match position. Using "last_char" instead of performing this search
seems to be incorrect.
Comment 3 Tim Waugh 2006-02-20 09:51:45 EST
Thanks!  Fixed in grep-2.5.1-53.

Note You need to log in before you can comment on or make changes to this bug.