Merge ~unity7maintainers/ubuntu/+source/nux:applied/ubuntu/devel into ubuntu/+source/nux:ubuntu/devel

Proposed by Rahammetoela Toekiman
Status: Needs review
Proposed branch: ~unity7maintainers/ubuntu/+source/nux:applied/ubuntu/devel
Merge into: ubuntu/+source/nux:ubuntu/devel
Diff against target: 142 lines (+45/-22)
4 files modified
Nux/Validator.cpp (+35/-19)
Nux/Validator.h (+3/-2)
configure.ac (+1/-1)
debian/changelog (+6/-0)
Reviewer Review Type Date Requested Status
Skia (community) Needs Fixing
Review via email: mp+495677@code.launchpad.net

Commit message

imported pcre2 migration from the gentoo team

To post a comment you must log in.
Revision history for this message
Rahammetoela Toekiman (fuseteam) wrote :

it currently fails to build, but i am having trouble figuring out why: https://launchpadlibrarian.net/830926741/buildlog.txt.gz

Revision history for this message
Athos Ribeiro (athos) wrote :

Thanks, Rahammetoela. Can you point us to the gentoo change from where this is being pulled from?

Also, this should be a patch under debian/patches. This should help you getting started: https://documentation.ubuntu.com/project/contributors/patching/work-with-debian-patches/

Revision history for this message
Rahammetoela Toekiman (fuseteam) wrote :

> Thanks, Rahammetoela. Can you point us to the gentoo change from where this is
> being pulled from?

I actually got it as a patch file from them via telegram

> Also, this should be a patch under debian/patches. This should help you
> getting started:
> https://documentation.ubuntu.com/project/contributors/patching/work-with-
> debian-patches/

is there particular reason why it should be under debian/patches?

Revision history for this message
Skia (skia) wrote :

debian/patches is the only place where the Debian build system will look for patches to apply before building, that's why your patch needs to go there. The link provided by @athos explains many things about how to work with patches.
I'm unsubscribing ~ubuntu-sponsors, feel free to resubscribed once you have performed the necessary changes and it's ready for review again.

review: Needs Fixing

Unmerged commits

ef41b97... by Rahammetoela Toekiman

migrate to libpcre2

4e62389... by Sebastien Bacher

4.0.8+18.10.20180623-0ubuntu11 (patches applied)

Imported using git-ubuntu import.

ca0c0e5... by Steve Langasek

4.0.8+18.10.20180623-0ubuntu10 (patches applied)

Imported using git-ubuntu import.

0bff976... by Steve Langasek

4.0.8+18.10.20180623-0ubuntu9 (patches applied)

Imported using git-ubuntu import.

9da570f... by Steve Langasek

4.0.8+18.10.20180623-0ubuntu8 (patches applied)

Imported using git-ubuntu import.

3dacbb2... by Matthias Klose

4.0.8+18.10.20180623-0ubuntu7 (patches applied)

Imported using git-ubuntu import.

8e1c06b... by Matthias Klose

4.0.8+18.10.20180623-0ubuntu6 (patches applied)

Imported using git-ubuntu import.

9fbfc6f... by Dimitri John Ledkov

4.0.8+18.10.20180623-0ubuntu5 (patches applied)

Imported using git-ubuntu import.

82b9772... by Jeremy BĂ­cha

4.0.8+18.10.20180623-0ubuntu4 (patches applied)

Imported using git-ubuntu import.

c3fe967... by Michael Hudson-Doyle

4.0.8+18.10.20180623-0ubuntu3 (patches applied)

Imported using git-ubuntu import.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Nux/Validator.cpp b/Nux/Validator.cpp
2index 0723930..a1021e7 100644
3--- a/Nux/Validator.cpp
4+++ b/Nux/Validator.cpp
5@@ -27,12 +27,19 @@ namespace nux
6 {
7
8 Validator::Validator()
9+#if !defined(NUX_OS_WINDOWS)
10+ : _regexp(nullptr)
11+#endif
12 {
13 }
14
15 Validator::~Validator()
16 {
17
18+#if !defined(NUX_OS_WINDOWS)
19+ if (_regexp)
20+ pcre2_code_free(_regexp);
21+#endif
22 }
23
24 bool Validator::InitRegExp()
25@@ -41,18 +48,23 @@ namespace nux
26 regex_ = _regexp_str.c_str();
27 return true;
28 #else
29- const char *error;
30- int erroffset;
31- _regexp = pcre_compile(
32- _regexp_str.c_str(), /* the pattern */
33- PCRE_MULTILINE,
34- &error, /* for error message */
35- &erroffset, /* for error offset */
36- 0); /* use default character tables */
37+ int errorcode;
38+ PCRE2_SIZE erroroffset;
39+ _regexp = pcre2_compile(
40+ reinterpret_cast<PCRE2_SPTR>(_regexp_str.c_str()), /* pattern */
41+ PCRE2_ZERO_TERMINATED, /* pattern length */
42+ PCRE2_MULTILINE, /* option bits */
43+ &errorcode, /* error code */
44+ &erroroffset, /* error offset */
45+ nullptr); /* compile context */
46
47 if (!_regexp)
48 {
49- nuxDebugMsg("[IntegerValidator::IntegerValidator] Invalid regular expression: %s", _regexp_str.c_str());
50+ PCRE2_UCHAR buffer[256];
51+ pcre2_get_error_message(errorcode, buffer, sizeof(buffer));
52+ nuxDebugMsg("[Validator::InitRegExp] Invalid regular expression '%s' "
53+ "at offset %d: %s",
54+ _regexp_str.c_str(), (int)erroroffset, buffer);
55 return false;
56 }
57 return true;
58@@ -72,20 +84,24 @@ namespace nux
59 }
60 return Validator::Acceptable;
61 #else
62- if (_regexp == 0)
63+ if (!_regexp || !str)
64 return Validator::Invalid;
65
66- int out_vector [10];
67- unsigned int offset = 0;
68- int len = (int) strlen(str);
69+ pcre2_match_data *match_data =
70+ pcre2_match_data_create_from_pattern(_regexp, nullptr);
71+
72+ int rc = pcre2_match(
73+ _regexp, /* compiled pattern */
74+ reinterpret_cast<PCRE2_SPTR>(str), /* subject string */
75+ strlen(str), /* length of subject */
76+ 0, /* start offset */
77+ 0, /* match options */
78+ match_data, /* match data block */
79+ nullptr); /* match context */
80
81- // See the "PCRE DISCUSSION OF STACK USAGE" and why it maybe necessary to limit the stack usage.
82- pcre_extra extra;
83- extra.flags = PCRE_EXTRA_MATCH_LIMIT_RECURSION;
84- extra.match_limit_recursion = 2000;
85+ pcre2_match_data_free(match_data);
86
87- int rc = pcre_exec(_regexp, &extra, str, len, offset, 0, out_vector, 10);
88- if (rc <= -1)
89+ if (rc < 0)
90 {
91 return Validator::Invalid;
92 }
93diff --git a/Nux/Validator.h b/Nux/Validator.h
94index ed729fc..4d7e9a5 100644
95--- a/Nux/Validator.h
96+++ b/Nux/Validator.h
97@@ -26,7 +26,8 @@
98 #if defined(NUX_OS_WINDOWS)
99 #include <regex>
100 #else
101- #include <pcre.h>
102+ #define PCRE2_CODE_UNIT_WIDTH 8
103+ #include <pcre2.h>
104 #endif
105
106 namespace nux
107@@ -57,7 +58,7 @@ namespace nux
108 #if defined(NUX_OS_WINDOWS)
109 std::regex regex_;
110 #else
111- pcre *_regexp;
112+ pcre2_code *_regexp;
113 #endif
114 };
115 }
116diff --git a/configure.ac b/configure.ac
117index a375300..8b047e7 100644
118--- a/configure.ac
119+++ b/configure.ac
120@@ -196,7 +196,7 @@ PKG_CHECK_MODULES(NUX,
121 sigc++-2.0
122 pango
123 pangocairo
124- libpcre
125+ libpcre2-8
126 )
127 AC_SUBST(NUX_CFLAGS)
128 AC_SUBST(NUX_LIBS)
129diff --git a/debian/changelog b/debian/changelog
130index 0e1b9d7..ec74964 100644
131--- a/debian/changelog
132+++ b/debian/changelog
133@@ -1,3 +1,9 @@
134+nux (4.0.8+18.10.20180623-0ubuntu12) resolute; urgency=medium
135+
136+ * migrated to libpcre2 (lp: #2103918)
137+
138+ -- Rahammetoela Toekiman <fusekai@outlook.com> Sun, 09 Nov 2025 22:17:47 -0300
139+
140 nux (4.0.8+18.10.20180623-0ubuntu11) questing; urgency=medium
141
142 * d/control: use the non deprecated libgdk-pixbuf-2.0-dev (lp: #2118581)

Subscribers

People subscribed via source and target branches