grep find lcase hits when only searching for ucase

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 6
  • grep-2.6.3-6.el6

Issue

  • grep find lcase hits when only searching for ucase
  • On rhel5 and rhel7 below command returns the ucase "SA" and blank line but on rhel6.6 any lcase word that does not include "a" is also returned. In addition the SA is colored while the lcase hits are not?
  echo -e "SA\nse\nsa\n\nsb"|grep --color "^[A-Z]*$"
RHEL6.6# echo -e "SA\nse\nsa\n\nsb"|grep --color "^[A-Z]*$"
SA
se

RHEL6.6#  grep -V
GNU grep 2.6.3
...
RHEL5# echo -e "SA\nse\nsa\n\nsb"|grep --color "^[A-Z]*$"
SA

RHEL5# grep -V
grep (GNU grep) 2.5.1
...

Resolution

Update grep package to grep-2.20-3.el6 released with Advisory RHSA-2015:1447-2 or newer.

Root Cause

The grep package version 2.6.3 was affected by a bug caused by erroneous usage of strcoll function to match multibyte characters in ranges. The rebased grep-2.20 no longer uses strcoll for the same and matching multibyte characters in ranges works properly.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments