Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): bump pcre from the legacy libpcre 8.45 to libpcre2 10.42 #12366

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ KONG_PACKAGE_NAME=kong
OPENRESTY=1.25.3.1
LUAROCKS=3.9.2
OPENSSL=3.2.0
PCRE=8.45
PCRE=10.42
LIBEXPAT=2.5.0

LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/apk.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COPY ${KONG_ARTIFACT_PATH}${KONG_ARTIFACT} /tmp/kong.apk.tar.gz
RUN apk upgrade --update-cache \
&& apk add --virtual .build-deps tar gzip \
&& tar -C / -xzf /tmp/kong.apk.tar.gz \
&& apk add --no-cache libstdc++ libgcc pcre perl tzdata libcap zlib zlib-dev bash yaml \
&& apk add --no-cache libstdc++ libgcc perl tzdata libcap zlib zlib-dev bash yaml \
&& adduser -S kong \
&& addgroup -S kong \
&& mkdir -p "${KONG_PREFIX}" \
Expand Down
14 changes: 14 additions & 0 deletions build/openresty/patches/openresty_02-pcre2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/configure b/configure
index 969b075..23322a9 100755
--- a/configure
+++ b/configure
@@ -557,9 +557,6 @@ _END_
"\n";
}

- # disable pcre2 by default
- push @ngx_opts, '--without-pcre2';
-
if (!$opts->{no_stream}
&& ! $opts->{no_stream_ssl}
&& ! $opts->{stream_ssl})
6 changes: 3 additions & 3 deletions build/openresty/pcre/BUILD.pcre.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ cmake(
],
cache_entries = {
"CMAKE_C_FLAGS": "${CMAKE_C_FLAGS:-} -fPIC",
"PCRE_BUILD_PCREGREP": "OFF", # we don't need the cli binary
"PCRE_BUILD_TESTS": "OFF", # test doesn't compile on aarch64-linux-gnu (cross)
"PCRE2_BUILD_PCRE2GREP": "OFF", # we don't need the cli binary
"PCRE2_BUILD_TESTS": "OFF", # test doesn't compile on aarch64-linux-gnu (cross)
"CMAKE_INSTALL_LIBDIR": "lib", # force distros that uses lib64 (rhel family) to use lib
},
lib_source = ":all_srcs",
out_static_libs = ["libpcre.a"],
out_static_libs = ["libpcre2-8.a"],
visibility = ["//visibility:public"],
)

Expand Down
7 changes: 3 additions & 4 deletions build/openresty/pcre/pcre_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ def pcre_repositories():
http_archive,
name = "pcre",
build_file = "//build/openresty/pcre:BUILD.pcre.bazel",
strip_prefix = "pcre-" + version,
sha256 = "4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09",
strip_prefix = "pcre2-" + version,
sha256 = "c33b418e3b936ee3153de2c61cc638e7e4fe3156022a5c77d0711bcbb9d64f1f",
urls = [
"https://mirror.bazel.build/downloads.sourceforge.net/project/pcre/pcre/" + version + "/pcre-" + version + ".tar.gz",
"https://downloads.sourceforge.net/project/pcre/pcre/" + version + "/pcre-" + version + ".tar.gz",
"https://github.com/PCRE2Project/pcre2/releases/download/pcre2-" + version + "/pcre2-" + version + ".tar.gz",
],
)
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/bump-pcre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "Bumped PCRE from the legacy libpcre 8.45 to libpcre2 10.42"
type: dependency
scope: Core
2 changes: 1 addition & 1 deletion kong/tools/uri.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ do
end


local ESCAPE_PATTERN = "[^!#$&'()*+,/:;=?@[\\]A-Z\\d-_.~%]"
local ESCAPE_PATTERN = "[^!#$&'()*+,/:;=?@[\\]A-Z\\d\\-_.~%]"

local TMP_OUTPUT = require("table.new")(16, 0)
local DOT = string_byte(".")
Expand Down
7 changes: 5 additions & 2 deletions scripts/explain_manifest/suites.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ def common_suites(expect, libxcrypt_no_obsolete_api: bool = False):
.has_ngx_http_request_t_DW.equals(True)

expect("/usr/local/openresty/nginx/sbin/nginx", "nginx binary should link pcre statically") \
.exported_symbols.contain("pcre_free") \
.needed_libraries.do_not().contain_match("libpcre.so.+")
.exported_symbols.contain("pcre2_general_context_free_8") \
.exported_symbols.do_not().contain("pcre_free") \
.needed_libraries.do_not().contain_match("libpcre.so.+") \
.needed_libraries.do_not().contain_match("libpcre.+.so.+") \
.needed_libraries.do_not().contain_match("libpcre2\-(8|16|32).so.+") \

expect("/usr/local/openresty/nginx/sbin/nginx", "nginx should not be compiled with debug flag") \
.nginx_compile_flags.do_not().match("with\-debug")
Expand Down
2 changes: 1 addition & 1 deletion spec/01-unit/01-db/01-schema/06-routes_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ describe("routes schema (flavor = traditional/traditional_compatible)", function
local ok, err = Routes:validate(route)
assert.falsy(ok)
assert.equal(u([[invalid regex: '/users/(foo/profile' (PCRE returned:
pcre_compile() failed: missing ) in
pcre2_compile() failed: missing closing parenthesis in
"/users/(foo/profile")]], true, true), err.paths[1])
end
end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,5 @@ it("validation should happens after migration", function ()
assert.falsy(config_tbl)
assert.matches("invalid regex:", err, nil, true)
assert.matches("/regex.+(", err, nil, true)
assert.matches("missing )", err, nil, true)
assert.matches("missing closing parenthesis", err, nil, true)
end)
Loading