Bug 580859

Summary: 'grep -i' is very slow with LC_CTYPE=zh_CN.gbk on certain files.
Product: Red Hat Enterprise Linux 5 Reporter: Kirby Zhou <kirbyzhou>
Component: grepAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: jskarvad, rvokal
Target Milestone: rcKeywords: Rebase
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-29 08:59:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The demo data none

Description Kirby Zhou 2010-04-09 09:44:49 UTC
Created attachment 405499 [details]
The demo data

Description of problem:

'grep -i' is very slow with LC_CTYPE=zh_CN.gbk on certain files.

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

grep-2.5.1-55.el5
glibc-2.5-42.el5_4.3

How reproducible:


Steps to Reproduce:

# xxxx is a file with size=2000000
time LC_ALL=zh_CN.gbk grep -qi  'chinese.*evaluation' xxxx 

Actual results:

real    0m8.589s
user    0m8.477s
sys     0m0.020s
 
Expected results:

less than 1s.

Additional info:

time LC_ALL=zh_CN.gbk grep -q 'chinese.*evaluation' xxxx   

real    0m0.004s
user    0m0.000s
sys     0m0.000s

time LC_ALL=en_US grep -qi 'chinese.*evaluation' xxxx 

real    0m0.004s
user    0m0.000s
sys     0m0.000s

Comment 2 Jaroslav Škarvada 2010-04-09 11:09:56 UTC
Results of running grep-2.6.3 on demo data from attachment:
$ time LC_ALL=zh_CN.gbk grep -qi  'chinese.*evaluation' xxxx 

real	0m0.028s
user	0m0.024s
sys	0m0.004s

$ grep --version
GNU grep 2.6.3

Comment 4 Kirby Zhou 2010-04-10 05:43:01 UTC
pcre-6.6-2.el5_1.7

Comment 5 Kirby Zhou 2010-05-10 17:20:52 UTC
it seems fixed in RHEL-6-beta and still exist in RHEL-5.5

Comment 7 RHEL Program Management 2010-08-09 18:23:52 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 8 Jaroslav Škarvada 2011-07-29 08:59:01 UTC
It was fixed in grep-2.6 that is included in RHEL-6 (comment 2). There were major changes of code in grep and backporting is hard/risky. Also the behaviour was changed (e.g. locale handling), thus rebase would probably affect a lot of users. That's why I am closing this as WONTFIX for RHEL-5.