RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1373363 - Incorrect parsing of regular expressions
Summary: Incorrect parsing of regular expressions
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Charalampos Stratakis
QA Contact: Branislav Náter
URL:
Whiteboard:
Depends On:
Blocks: 1380359 1393868
TreeView+ depends on / blocked
 
Reported: 2016-09-06 06:07 UTC by paulgraydon
Modified: 2017-09-17 23:29 UTC (History)
5 users (show)

Fixed In Version: python-2.7.5-50.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2017-08-01 20:25:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Python 18647 0 None None None 2016-09-06 06:07:26 UTC
Red Hat Product Errata RHSA-2017:1868 0 normal SHIPPED_LIVE Moderate: python security and bug fix update 2017-08-01 18:24:21 UTC

Description paulgraydon 2016-09-06 06:07:26 UTC
Description of problem:

A bug was identified by the python developers that meant python incorrectly parsed certain regular expressions (http://bugs.python.org/issue18647).  This incorrect behaviour is present in the version of Python shipped with RHEL7, and may trip up unsuspecting users.  Not sure if, under the circumstances, you see value in backporting this fix.

Fixed by this commit https://github.com/python/cpython/commit/d30106dddd09af83ca5f0c49ac5a499f891dbdbe

If I'm reading the git history correctly, it looks like it was fixed ahead of the 2.7.6rc1 release.

Version-Release number of selected component (if applicable):


How reproducible:  Easy


Steps to Reproduce:

$ cat ~/bug.py
import re

re.compile("(?P<thing>\w*)?")
print "All OK!"

$ python ~/bug.py
Traceback (most recent call last):
  File "/home/opc/bug.py", line 3, in <module>
    re.compile("(?P<thing>\w*)?")
  File "/usr/lib64/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.7/re.py", line 242, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat


Expected results:

Should return "All OK!"


Additional info:

Comment 6 Charalampos Stratakis 2016-09-06 14:48:54 UTC
(In reply to paulgraydon from comment #0)
> Description of problem:
> 
> A bug was identified by the python developers that meant python incorrectly
> parsed certain regular expressions (http://bugs.python.org/issue18647). 
> This incorrect behaviour is present in the version of Python shipped with
> RHEL7, and may trip up unsuspecting users.  Not sure if, under the
> circumstances, you see value in backporting this fix.

Hello and thank you for the bug report.

The issue will be evaluated for a fix, however it's not high on the priority list at the moment.

Comment 9 Branislav Náter 2017-04-26 12:05:19 UTC
Reproduced on python-2.7.5-48.el7:

:: [  BEGIN   ] :: Run reproducer :: actually running 'python test.py'
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    re.compile("(?P<thing>\w*)?")
  File "/usr/lib64/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.7/re.py", line 242, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat
:: [   FAIL   ] :: Run reproducer (Expected 0, got 1)

Verified on python-2.7.5-57.el7:
Regular expression is correctly parsed

:: [  BEGIN   ] :: Run reproducer :: actually running 'python test.py'
:: [   PASS   ] :: Run reproducer (Expected 0, got 0)

Comment 10 errata-xmlrpc 2017-08-01 20:25:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:1868

Comment 11 Alan Pevec (Fedora) 2017-09-15 21:24:55 UTC
Heads up (will get proper BZ with reproducer filed later) this might have broken one of OpenStack deps: https://bugs.launchpad.net/tripleo/+bug/1717545


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