Bug 135975 - Perl's 'study' function breaks regexp matching
Summary: Perl's 'study' function breaks regexp matching
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: perl
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jason Vas Dias
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On: 172792
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-10-15 23:49 UTC by JP Vossen
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: RHSA-2005-881
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-12-20 14:56:57 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2005:881 0 normal SHIPPED_LIVE Moderate: perl security update 2005-12-20 05:00:00 UTC

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



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