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   
Fixed In Version: Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-29 04:59:01 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
The demo data none

Description Kirby Zhou 2010-04-09 05:44:49 EDT
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):


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 07:09:56 EDT
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 01:43:01 EDT
Comment 5 Kirby Zhou 2010-05-10 13:20:52 EDT
it seems fixed in RHEL-6-beta and still exist in RHEL-5.5
Comment 7 RHEL Product and Program Management 2010-08-09 14:23:52 EDT
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 04:59:01 EDT
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.