Bug 135975

Summary: Perl's 'study' function breaks regexp matching
Product: Red Hat Enterprise Linux 3 Reporter: JP Vossen <jp>
Component: perlAssignee: Jason Vas Dias <jvdias>
Status: CLOSED ERRATA QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: poelstra
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: RHSA-2005-881 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-12-20 14:56:57 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:
Bug Depends On: 172792    
Bug Blocks:    
Attachments:
Description Flags
Busted-RHEL-Perl.txt none

Description JP Vossen 2004-10-15 23:49:13 UTC
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 23:50:45 UTC
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 18:52:23 UTC
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 20:23:10 UTC
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 20:45:00 UTC
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 14:56:58 UTC
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