Red Hat Bugzilla – Bug 135975
Perl's 'study' function breaks regexp matching
Last modified: 2007-11-30 17:07:04 EST
Description of problem:
When I use Perl's study function under RHEL 3 (base and after Q3
errata) it causes a regexp that should match to fail to match if the
data comes from outside the script (e.g. pipeline or input file).
Version-Release number of selected component (if applicable):
perl-5.8.0-88.4 and perl-5.8.0-88.7
Steps to Reproduce and Actual results:
/home/jp$ perl -e '$aline = q(ABCDEFGHIJK); study($aline); $aline =~
s!HIJK$!1234!g; print qq($aline\n);'
/home/jp$ echo 'ABCDEFGHIJK' | perl -pe 's!HIJK$!1234!g;'
/home/jp$ echo 'ABCDEFGHIJK' | perl -pe 'study; s!HIJK$!1234!g;'
# ^^^^ <<< Expected 'ABCDEFG1234' here!!!
# RHEL 3, perl-5.8.0-88.7 (& perl-5.8.0-88.4) = BROKEN
# Centos-3, perl-5.8.0-88.4.0 = BROKEN
# cAos-1, perl-5.8.0-91.caos = Works
# Red Hat 8, perl-5.8.0-88.3 = Works
# Windows XP (NONE SP2), ActivePerl 5.8 = works
# Solaris 7, Perl 5.6 = Works
Created attachment 105314 [details]
Simple test script and session logs of testing on various platforms.
This bug is similar to an upstream perl bug:
'17757: s///g fails when using English & study in 5.8.0'
( http://rt.perl.org/rt3/Ticket/Display.html?id=17757 )
and is fixed by upstream patches 18553 ( replaced by 19210 ).
The upstream patch for this issue has been applied and this
bug is fixed in the next perl release for RHEL-3 : perl-5.8.0-90.2 .
Actually, this is not quite fixed: it is the UTF-8 locale which enables
UTF-8 support that makes study() break regexps. This is still a bug with
the upstream perl-5.8.7 releases (perl bug 37646 raised).
While the fix partially fixed the problem, this bug is still a problem if
UTF-8 support is enabled, which it is by default since the default locale
Workaround: run your perl scripts with 'LC_ALL=C' .
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.