Bug 135975 - Perl's 'study' function breaks regexp matching
Perl's 'study' function breaks regexp matching
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: perl (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
David Lawrence
:
Depends On: 172792
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-15 19:49 EDT by JP Vossen
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: RHSA-2005-881
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-12-20 09:56:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Busted-RHEL-Perl.txt (5.12 KB, text/plain)
2004-10-15 19:50 EDT, JP Vossen
no flags Details

  None (edit)
Description JP Vossen 2004-10-15 19:49:13 EDT
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);'
ABCDEFG1234

/home/jp$ echo 'ABCDEFGHIJK' | perl -pe 's!HIJK$!1234!g;'
ABCDEFG1234

/home/jp$ echo 'ABCDEFGHIJK' | perl -pe 'study; s!HIJK$!1234!g;'
ABCDEFGHIJK
#      ^^^^  <<< Expected 'ABCDEFG1234' here!!!


Additional info:
# 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
Comment 1 JP Vossen 2004-10-15 19:50:45 EDT
Created attachment 105314 [details]
Busted-RHEL-Perl.txt

Simple test script and session logs of testing on various platforms.
Comment 2 Jason Vas Dias 2005-11-09 13:52:23 EST
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 .

Comment 3 Jason Vas Dias 2005-11-09 15:23:10 EST
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).
Comment 4 Jason Vas Dias 2005-11-09 15:45:00 EST
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
is en_US.UTF-8.
Workaround: run your perl scripts with 'LC_ALL=C' .
Comment 6 Red Hat Bugzilla 2005-12-20 09:56:58 EST
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.

http://rhn.redhat.com/errata/RHSA-2005-881.html

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