Bug 383632 - "Broken regex" build failure
Summary: "Broken regex" build failure
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: framework (show other bugs)
Version: 5.37.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-17 13:57 UTC by Bart Ribbers
Modified: 2017-08-23 18:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bart Ribbers 2017-08-17 13:57:05 UTC
Trying to build syntax-highlighting results in a "broken regex" error for multiple lines.


"/home/user/build/src/syntax-highlighting-5.37.0/data/syntax/rest.xml" line 27 broken regex: "^\\s*\\.\\. [\\w-_\\.]+::(\\s|$)" problem: "invalid range in character class" at offset 12
"/home/user/build/src/syntax-highlighting-5.37.0/data/syntax/rest.xml" line 31 broken regex: "^(\\s*)\\.\\.\\s(?![\\w-_\\.]+::(\\s|$))" problem: "invalid range in character class" at offset 18
"/home/user/build/src/syntax-highlighting-5.37.0/data/syntax/rest.xml" line 41 broken regex: "(^|[-\\s'\"\\(\\[{</:‘“’«¡¿‐‑‒–— ])`[^\\s].*`(?=:[\\w-_\\.\\+]+:)" problem: "invalid range in character class" at offset 47
"/home/user/build/src/syntax-highlighting-5.37.0/data/syntax/rest.xml" line 42 broken regex: ":[\\w-_\\.\\+]+:(?=`)" problem: "invalid range in character class" at offset 4
"/home/user/build/src/syntax-highlighting-5.37.0/data/syntax/rest.xml" line 59 broken regex: ":[\\w-_\\.\\+]+:" problem: "invalid range in character class" at offset 4



Commenting out those lines fixes the issue, but is obviously not preferable.
Comment 1 Pablo Cholaky 2017-08-22 02:25:52 UTC
I can also confirm this problem under Gentoo, using Qt 5.9.1
Comment 2 Heiko Becker 2017-08-23 14:27:40 UTC
Git commit ad077e4045e650e1708b6c81d33a14f4a9c99a5d by Heiko Becker.
Committed on 23/08/2017 at 14:16.
Pushed by heikobecker into branch 'master'.

Escape hyphen in rest.xml regular expressions

Summary:
The unescaped hyphen caused a build failure with pcre2-10.30 due to a broken
regex: 'syntax-highlighting/data/syntax/rest.xml" line 27 broken regex:
"^\\s*\\.\\. [w-_\\.]+::(\\s|$)" problem: "range out of order in character
class" at offset 12'.

The pcre2pattern documentation says this:

"Perl treats a hyphen as a literal if it appears before or after a POSIX class
(see below) or before or after a character type escape such as as \d or \H.
However, unless the hyphen is the last character in the class, Perl outputs a
warning in its warning mode, as this is most likely a user error. As PCRE2 has
no facility for warning, an error is given in these cases."

Test Plan:
cmake && make && make test works fine pcre2-10.30, quick look at
http://docutils.sourceforge.net/FAQ.txt in kate seems fine.

Reviewers: #framework_syntax_hightlighting, kfunk

Subscribers: #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D7478

M  +6    -6    data/syntax/rest.xml

https://commits.kde.org/syntax-highlighting/ad077e4045e650e1708b6c81d33a14f4a9c99a5d