Bug 1743863

Summary: Regression with lookbehind regex in 10.33-8
Product: [Fedora] Fedora Reporter: Milan Bouchet-Valat <nalimilan>
Component: pcre2Assignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: ppisar
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://bugs.exim.org/show_bug.cgi?id=2433
Whiteboard:
Fixed In Version: pcre2-10.33-13.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-30 08:06:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Milan Bouchet-Valat 2019-08-20 20:43:47 UTC
I was trying to upgrade the julia package to the new stable version, but the build failed due to a behavior change in pcre2 which appears to be a regression, apparently due to patches backported from upstream.

The regular expression in question is quite complex (it is used to parse git URLs):

^(?:(?<scheme>ssh|git|https?)://)?+
(?:
    (?<user>.*?)
    (?:\:(?<password>.*?))?@
)?
(?<host>[A-Za-z0-9\-\.]+)
(?(<scheme>)
    # Only parse port when not using scp-like syntax
    (?:\:(?<port>\d+))?
    /?
    |
    :?
)
(?<path>
    # Require path to be preceded by '/'. Alternatively, ':' when using scp-like syntax.
    (?<=(?(<scheme>)/|:))
    .*
)?
$

Here are two examples of failing tests:

String: "https://user:pass@server.com:80/org/project.git"
Obtained <path> in 10.33-6: "org/project.git"
Obtained <path> in 10.33-8: "/org/project.git"

String: "user@server:project.git"
Obtained <path> in 10.33-6: "project.git"
Obtained <path> in 10.33-8: ":project.git"

I cannot exclude that the regex was incorrect and only happened to work due to a bug in previous PCRE versions. But it seems to me that this part should consume / and : :
(?(<scheme>)
    # Only parse port when not using scp-like syntax
    (?:\:(?<port>\d+))?
    /?
    |
    :?
)

Thanks

Comment 1 Petr Pisar 2019-08-21 09:01:51 UTC
I confirm 10.33-8 broke it. It's was this upstream commit:

commit d70442f2c962ca816b8d03504a07e618c271a9fe
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date:   Tue Jul 16 15:06:21 2019 +0000

    Fix lookbehind within lookahead within lookbehind misbehaviour bug.
    
    
    git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1133 6239d852-aaf2-0410-a92c-79f79f948
069

I believe this is a bug and I will work with upstream on fixing it.

Comment 2 Petr Pisar 2019-08-21 10:39:38 UTC
Reported to upstream at <https://bugs.exim.org/show_bug.cgi?id=2433>.

Comment 3 Milan Bouchet-Valat 2019-08-23 18:04:21 UTC
Thanks! Do you want to revert this or should I bundle PCRE until it's fixed? Julia has been FTBFS since before the mass rebuild, so I really have to get a build passing for F31.

Comment 4 Petr Pisar 2019-08-26 07:12:54 UTC
I was waiting on upstream's response. There was none. I've reverted it now.

Comment 5 Fedora Update System 2019-08-26 07:30:26 UTC
FEDORA-2019-f0f0ff64bb has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f0f0ff64bb

Comment 6 Fedora Update System 2019-08-26 07:30:34 UTC
FEDORA-2019-f93fcb9fbd has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f93fcb9fbd

Comment 7 Petr Pisar 2019-08-27 09:44:48 UTC
Upstream developed a fix for this regression. I will revert the revert and apply the proper fix.

Comment 8 Fedora Update System 2019-08-27 18:21:49 UTC
pcre2-10.33-12.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f0f0ff64bb

Comment 9 Fedora Update System 2019-08-27 18:27:28 UTC
pcre2-10.33-12.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f93fcb9fbd

Comment 10 Fedora Update System 2019-08-28 06:05:45 UTC
FEDORA-2019-f0f0ff64bb has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f0f0ff64bb

Comment 11 Fedora Update System 2019-08-28 06:06:32 UTC
FEDORA-2019-f93fcb9fbd has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f93fcb9fbd

Comment 12 Milan Bouchet-Valat 2019-08-28 10:06:56 UTC
Thanks!

Comment 13 Fedora Update System 2019-08-28 11:06:49 UTC
FEDORA-2019-55d30d69d3 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-55d30d69d3

Comment 14 Fedora Update System 2019-08-29 21:01:42 UTC
pcre2-10.33-13.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-55d30d69d3

Comment 15 Fedora Update System 2019-08-30 00:03:48 UTC
pcre2-10.33-13.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f0f0ff64bb

Comment 16 Fedora Update System 2019-08-30 00:24:57 UTC
pcre2-10.33-13.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f93fcb9fbd

Comment 17 Fedora Update System 2019-08-30 14:20:50 UTC
pcre2-10.33-13.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2019-09-14 00:06:38 UTC
pcre2-10.33-13.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2019-09-14 01:54:06 UTC
pcre2-10.33-13.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2019-09-14 16:30:54 UTC
pcre2-10.33-13.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.