Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2219897/?format=api
{ "id": 2219897, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2219897/?format=api", "web_url": "http://patchwork.ozlabs.org/project/buildroot/patch/20260405103851.2855053-4-bernd@kuhls.net/", "project": { "id": 27, "url": "http://patchwork.ozlabs.org/api/1.2/projects/27/?format=api", "name": "Buildroot development", "link_name": "buildroot", "list_id": "buildroot.buildroot.org", "list_email": "buildroot@buildroot.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260405103851.2855053-4-bernd@kuhls.net>", "list_archive_url": null, "date": "2026-04-05T10:38:50", "name": "[4/4] package/c-icap: switch to pcre2", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "55a4c06d338778a02dc9ee5e1bdadf5f0fa8504c", "submitter": { "id": 86624, "url": "http://patchwork.ozlabs.org/api/1.2/people/86624/?format=api", "name": "Bernd Kuhls", "email": "bernd@kuhls.net" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/buildroot/patch/20260405103851.2855053-4-bernd@kuhls.net/mbox/", "series": [ { "id": 498770, "url": "http://patchwork.ozlabs.org/api/1.2/series/498770/?format=api", "web_url": "http://patchwork.ozlabs.org/project/buildroot/list/?series=498770", "date": "2026-04-05T10:38:47", "name": "[1/4] package/c-icap: fix musl build", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498770/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219897/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219897/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<buildroot-bounces@buildroot.org>", "X-Original-To": [ "incoming-buildroot@patchwork.ozlabs.org", "buildroot@buildroot.org" ], "Delivered-To": [ "patchwork-incoming-buildroot@legolas.ozlabs.org", "buildroot@buildroot.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=buildroot.org header.i=@buildroot.org\n header.a=rsa-sha256 header.s=default header.b=gnYDiNfC;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org\n (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org;\n envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org)" ], "Received": [ "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpTVL3ybpz1yCs\n\tfor <incoming-buildroot@patchwork.ozlabs.org>;\n Sun, 05 Apr 2026 20:39:38 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 259F88120F;\n\tSun, 5 Apr 2026 10:39:37 +0000 (UTC)", "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id t17mEpwjeqHv; Sun, 5 Apr 2026 10:39:35 +0000 (UTC)", "from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 6878581213;\n\tSun, 5 Apr 2026 10:39:35 +0000 (UTC)", "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by lists1.osuosl.org (Postfix) with ESMTP id CD916219\n for <buildroot@buildroot.org>; Sun, 5 Apr 2026 10:39:34 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id BF47540060\n for <buildroot@buildroot.org>; Sun, 5 Apr 2026 10:39:34 +0000 (UTC)", "from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id Dj8z-lAnfx8K for <buildroot@buildroot.org>;\n Sun, 5 Apr 2026 10:39:33 +0000 (UTC)", "from dd20012.kasserver.com (dd20012.kasserver.com [85.13.140.57])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 020C24005B\n for <buildroot@buildroot.org>; Sun, 5 Apr 2026 10:39:32 +0000 (UTC)", "from fli4l.lan.fli4l (p5b3a012a.dip0.t-ipconnect.de [91.58.1.42])\n by dd20012.kasserver.com (Postfix) with ESMTPSA id 3FB7AA4C38ED\n for <buildroot@buildroot.org>; Sun, 5 Apr 2026 12:38:52 +0200 (CEST)", "from bruckner.lan.fli4l ([192.168.1.1]:53282)\n by fli4l.lan.fli4l with esmtp (Exim 4.99.1)\n (envelope-from <bernd@kuhls.net>) id 1w9KsV-000000007LA-2Rey\n for buildroot@buildroot.org; Sun, 05 Apr 2026 10:38:51 +0000" ], "X-Virus-Scanned": [ "amavis at osuosl.org", "amavis at osuosl.org" ], "X-Comment": "SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org;\n receiver=<UNKNOWN> ", "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6878581213", "OpenDKIM Filter v2.11.0 smtp2.osuosl.org 020C24005B" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=buildroot.org;\n\ts=default; t=1775385575;\n\tbh=biS7dZPYUjw3ULvaLiBxrqAsyripzdKQynXEDbGZkeA=;\n\th=From:To:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=gnYDiNfCq3cljGjpOuRTA2L7yuzwa/Fod6k4lfKrvSWBYRZD7dG0wAqkevdIGPbfC\n\t ZXGGBDeK4dUbhud5lvHYZaNfD1bZ82JFhHfxbTwGXDZG6CEh8xAKdGe6Id3yVec7s0\n\t rjhdggnZ1lWz7yqOuyhHkQu8H+8YId9c33+MALrgXj4CNr66MidhPgBY5/TVME7DQN\n\t PzN8Fhh6L4RihbZLh2Y/8e8/Ry/NlOr/uM15XgOs0pzECtQ37xk9pkIWHPpLrhMFil\n\t ++vDECbJMqpV/Ky9rm5zllJOZ3tZDILZRiec6SHhkL+9hRJqfLrFRSyZ5uhEIHaWzO\n\t +/XqggLYYt6TA==", "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=85.13.140.57;\n helo=dd20012.kasserver.com; envelope-from=bernd@kuhls.net;\n receiver=<UNKNOWN>", "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp2.osuosl.org 020C24005B", "From": "Bernd Kuhls <bernd@kuhls.net>", "To": "buildroot@buildroot.org", "Date": "Sun, 5 Apr 2026 12:38:50 +0200", "Message-ID": "<20260405103851.2855053-4-bernd@kuhls.net>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260405103851.2855053-1-bernd@kuhls.net>", "References": "<20260405103851.2855053-1-bernd@kuhls.net>", "MIME-Version": "1.0", "X-Spamd-Bar": "/", "X-Mailman-Original-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=kuhls.net;\n s=kas202511301023; t=1775385532;\n bh=tNwH4zEhtTc00miurrEWJwdpXdkgnZXPbtH1VzHOIEA=;\n h=From:To:Subject:Date:In-Reply-To:From;\n b=bsRd6ZFQYnBnkuhZPkbl8Z5xmKII1mLO6o9L5tRjT2vC6R/Tk20HF5/yzF71ogfCc\n MCmpwwnMVaXQC5+6ZSKX9/z+4Dr9J9FIXJ4BNTQCeNuPOBEHXcSlKY8FLyw/UueShL\n +284iQJyjdJD3wEZvBlRmKcl04ymrcBbQZvCBhDn4qJO6cUfFiOXrbIKuB2E4/Rb//\n 7fZmcE5eJODqSsyE9XdWAfC9hQWfNauKneiih/dPmE8yt3nwPENNUQg/6mYKK36sYM\n wwJZq2qPQoK4mW57FrdS/Vqrk9AMjVdiEIN/e+bcf2/9yRDxVk2N63tqXkPyPjcW4G\n jjS5zXUjUJvxA==", "X-Mailman-Original-Authentication-Results": [ "smtp2.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=kuhls.net", "smtp2.osuosl.org;\n dkim=pass (2048-bit key) header.d=kuhls.net header.i=@kuhls.net\n header.a=rsa-sha256 header.s=kas202511301023 header.b=bsRd6ZFQ" ], "Subject": "[Buildroot] [PATCH 4/4] package/c-icap: switch to pcre2", "X-BeenThere": "buildroot@buildroot.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Discussion and development of buildroot <buildroot.buildroot.org>", "List-Unsubscribe": "<https://lists.buildroot.org/mailman/options/buildroot>,\n <mailto:buildroot-request@buildroot.org?subject=unsubscribe>", "List-Archive": "<http://lists.buildroot.org/pipermail/buildroot/>", "List-Post": "<mailto:buildroot@buildroot.org>", "List-Help": "<mailto:buildroot-request@buildroot.org?subject=help>", "List-Subscribe": "<https://lists.buildroot.org/mailman/listinfo/buildroot>,\n <mailto:buildroot-request@buildroot.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "buildroot-bounces@buildroot.org", "Sender": "\"buildroot\" <buildroot-bounces@buildroot.org>" }, "content": "Added two patches backported from the upstream branch c_icap_0_6_x which\nwere backported by Debian to the 0.5.x branch.\n\nBuild-tested using this defconfig:\n\nBR2_PACKAGE_PCRE2=y\nBR2_PACKAGE_C_ICAP=y\nBR2_PACKAGE_C_ICAP_MODULES=y\n\n arm-aarch64 [ 1/32]: OK\n bootlin-aarch64-glibc [ 2/32]: OK\n bootlin-aarch64-glibc-old [ 3/32]: FAILED\n bootlin-arcle-hs38-uclibc [ 4/32]: OK\n bootlin-armv5-uclibc [ 5/32]: OK\n bootlin-armv7-glibc [ 6/32]: OK\n bootlin-armv7m-uclibc [ 7/32]: SKIPPED\n bootlin-armv7-musl [ 8/32]: OK\n bootlin-m68k-5208-uclibc [ 9/32]: SKIPPED\n bootlin-m68k-68040-uclibc [10/32]: OK\n bootlin-microblazeel-uclibc [11/32]: OK\n bootlin-mips64el-glibc [12/32]: OK\n bootlin-mipsel32r6-glibc [13/32]: OK\n bootlin-mipsel-uclibc [14/32]: OK\n bootlin-openrisc-uclibc [15/32]: OK\n bootlin-powerpc64le-power8-glibc [16/32]: OK\n bootlin-powerpc-e500mc-uclibc [17/32]: OK\n bootlin-riscv32-glibc [18/32]: OK\n bootlin-riscv64-glibc [19/32]: OK\n bootlin-riscv64-musl [20/32]: OK\n bootlin-s390x-z13-glibc [21/32]: OK\n bootlin-sh4-uclibc [22/32]: OK\n bootlin-sparc64-glibc [23/32]: OK\n bootlin-sparc-uclibc [24/32]: OK\n bootlin-x86-64-glibc [25/32]: OK\n bootlin-x86-64-musl [26/32]: OK\n bootlin-x86-64-uclibc [27/32]: OK\n bootlin-x86-i686-musl [28/32]: OK\n bootlin-xtensa-uclibc [29/32]: OK\n br-arm-basic [30/32]: FAILED\n br-arm-full-nothread [31/32]: SKIPPED\n br-arm-full-static [32/32]: SKIPPED\n\n32 builds, 4 skipped, 2 build failed, 0 legal-info failed, 0 show-info failed\n\nThe two build errors are unrelated to this patch, they are caused by\npatch 0005-Fix-module-operation-prototypes-to-fix-GCC-15.x-buil.patch\nwhich breaks the build with gcc <= 9.x:\n\nhttp_auth.c: In function ‘basic_close’:\nhttp_auth.c:412:25: error: parameter name omitted\n void basic_close(struct ci_server_conf *)\n\nSigned-off-by: Bernd Kuhls <bernd@kuhls.net>\n---\n .../c-icap/0006-Backport-pcre2-support.patch | 569 ++++++++++++++++++\n ...ing-_CI_ASSERT-macro-for-pcre2-patch.patch | 50 ++\n package/c-icap/c-icap.mk | 9 +-\n 3 files changed, 624 insertions(+), 4 deletions(-)\n create mode 100644 package/c-icap/0006-Backport-pcre2-support.patch\n create mode 100644 package/c-icap/0007-Add-missing-_CI_ASSERT-macro-for-pcre2-patch.patch", "diff": "diff --git a/package/c-icap/0006-Backport-pcre2-support.patch b/package/c-icap/0006-Backport-pcre2-support.patch\nnew file mode 100644\nindex 0000000000..76d42f7527\n--- /dev/null\n+++ b/package/c-icap/0006-Backport-pcre2-support.patch\n@@ -0,0 +1,569 @@\n+From: Boyuan Yang <byang@debian.org>\n+Date: Sat, 29 Jul 2023 19:13:16 -0400\n+Subject: Backport pcre2 support\n+\n+Bug-Debian: https://bugs.debian.org/1000077\n+Upstream: https://github.com/c-icap/c-icap-server/commit/888a98ff382d782729f000876b4e81f08d9046d3\n+\n+Downloaded from\n+https://sources.debian.org/src/c-icap/1%3A0.5.10-7/debian/patches/0005-Backport-pcre2-support.patch\n+\n+[Bernd: rebased for 0.5.14]\n+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>\n+---\n+ Makefile.am | 16 +++-\n+ aserver.c | 2 +\n+ configure.ac | 51 ++++++++++++-\n+ include/ci_regex.h | 43 ++++++++++-\n+ regex.c | 210 ++++++++++++++++++++++++++++++++++++++++++++++++-----\n+ types_ops.c | 4 +-\n+ 6 files changed, 296 insertions(+), 30 deletions(-)\n+\n+diff --git a/Makefile.am b/Makefile.am\n+index acfa0d0..ebdf51c 100644\n+--- a/Makefile.am\n++++ b/Makefile.am\n+@@ -22,11 +22,23 @@ bin_PROGRAMS = c-icap\n+ \n+ bin_SCRIPTS = c-icap-config c-icap-libicapapi-config\n+ \n++UTIL_FLAGS=\n++UTIL_LDADD=\n+ UTIL_LIB_SOURCES=net_io.c util.c os/unix/net_io.c os/unix/proc_mutex.c os/unix/shared_mem.c os/unix/threads.c os/unix/utilfunc.c os/unix/dlib.c\n+ if USE_OPENSSL\n+ UTIL_LIB_SOURCES += openssl/net_io_ssl.c\n+ endif\n++\n+ if USE_REGEX\n++if USE_PCRE2\n++UTIL_FLAGS += @PCRE2_ADD_FLAG@\n++UTIL_LDADD += @PCRE2_ADD_LDADD@\n++endif\n++if USE_PCRE\n++UTIL_FLAGS += @PCRE_ADD_FLAG@\n++UTIL_LDADD += @PCRE_ADD_LDADD@\n++endif\n++\n+ UTIL_LIB_SOURCES += regex.c\n+ endif\n+ UTIL_SOURCES=os/unix/proc_utils.c\n+@@ -50,9 +62,9 @@ c_icap_SOURCES = aserver.c request.c cfg_param.c \\\n+ \n+ \n+ # libicapapi ......\n+-libicapapi_la_CFLAGS= $(INVISIBILITY_CFLAG) -I$(srcdir)/include/ -Iinclude/ @ZLIB_ADD_FLAG@ @OPENSSL_ADD_FLAG@ @BZLIB_ADD_FLAG@ @BROTLI_ADD_FLAG@ @ZSTD_ADD_FLAG@ @PCRE_ADD_FLAG@ -DCI_BUILD_LIB\n++libicapapi_la_CFLAGS= $(INVISIBILITY_CFLAG) -I$(srcdir)/include/ -Iinclude/ @ZLIB_ADD_FLAG@ @OPENSSL_ADD_FLAG@ @BZLIB_ADD_FLAG@ @BROTLI_ADD_FLAG@ @ZSTD_ADD_FLAG@ $(UTIL_FLAG) -DCI_BUILD_LIB\n+ \n+-libicapapi_la_LIBADD = @ZLIB_ADD_LDADD@ @BZLIB_ADD_LDADD@ @BROTLI_ADD_LDADD@ @ZSTD_ADD_LDADD@ @PCRE_ADD_LDADD@ @DL_ADD_FLAG@ @THREADS_LDADD@ @OPENSSL_ADD_LDADD@\n++libicapapi_la_LIBADD = @ZLIB_ADD_LDADD@ @BZLIB_ADD_LDADD@ @BROTLI_ADD_LDADD@ @ZSTD_ADD_LDADD@ $(UTIL_LDADD) @DL_ADD_FLAG@ @THREADS_LDADD@ @OPENSSL_ADD_LDADD@\n+ libicapapi_la_LDFLAGS= -shared -version-info @CICAPLIB_VERSION@ @LIBS_LDFLAGS@ @THREADS_LDFLAGS@\n+ \n+ export EXT_PROGRAMS_MKLIB = @ZLIB_LNDIR_LDADD@ @BZLIB_LNDIR_LDADD@ @BROTLI_LNDIR_LDADD@ @ZSTD_LNDIR_LDADD@ @PCRE_LNDIR_LDADD@ @OPENSSL_LNDIR_LDADD@\n+diff --git a/aserver.c b/aserver.c\n+index 9eaa609..990be9d 100644\n+--- a/aserver.c\n++++ b/aserver.c\n+@@ -29,6 +29,7 @@\n+ #endif\n+ #include \"txtTemplate.h\"\n+ #include \"commands.h\"\n++#include \"ci_regex.h\"\n+ \n+ /*\n+ extern char *PIDFILE;\n+@@ -142,6 +143,7 @@ int main(int argc, char **argv)\n+ }\n+ ci_txt_template_init();\n+ ci_txt_template_set_dir(DATADIR\"templates\");\n++ ci_regex_memory_init();\n+ commands_init();\n+ \n+ if (!(CI_CONF.MAGIC_DB = ci_magic_db_load(CI_CONF.magics_file))) {\n+diff --git a/configure.ac b/configure.ac\n+index 2144011..08a937f 100644\n+--- a/configure.ac\n++++ b/configure.ac\n+@@ -246,6 +246,7 @@ AC_ARG_ENABLE(rpath,\n+ #Routines used for checking libraries\n+ AC_DEFUN([ICFG_STATE_SAVE],[\n+ #save state\n++ICFG_OLD_CPPFLAGS=$CPPFLAGS\n+ ICFG_OLD_CFLAGS=$CFLAGS\n+ ICFG_OLD_LDFLAGS=$LDFLAGS\n+ ICFG_OLD_LIBS=$LIBS\n+@@ -253,7 +254,8 @@ ICFG_OLD_LIBS=$LIBS\n+ \n+ #Routines used for checking libraries\n+ AC_DEFUN([ICFG_STATE_ROLLBACK],[\n+-#save state\n++#rollback saved state\n++CPPFLAGS=$ICFG_OLD_CPPFLAGS\n+ CFLAGS=$ICFG_OLD_CFLAGS\n+ LDFLAGS=$ICFG_OLD_LDFLAGS\n+ LIBS=$ICFG_OLD_LIBS\n+@@ -650,6 +652,45 @@ if test a\"$libmemcached\" != \"ano\"; then\n+ ICFG_STATE_ROLLBACK\n+ fi\n+ \n++# Check for PCRE2 regex library\n++AC_ARG_WITH(pcre2,\n++[ --with-pcre2 Path to PCRE2 library],\n++[\n++case \"$withval\" in\n++ yes)\n++ pcre2=yes;\n++ ;;\n++ no)\n++ pcre2=no;\n++ ;;\n++ *)\n++ pcre2=yes;\n++ pcre2path=$withval;\n++ ;;\n++ esac\n++],\n++[ pcre2=yes]\n++)\n++\n++if test a\"$pcre2\" != \"ano\"; then\n++ ICFG_STATE_SAVE(PCRE2)\n++ CPPFLAGS=\"$CPPFLAGS -DPCRE2_CODE_UNIT_WIDTH=8\"\n++ if test \"a$pcre2path\" != \"a\"; then\n++ CFLAGS=\"$CFLAGS -I$pcre2path/include\"\n++ LDFLAGS=\"$LDFLAGS -L$pcre2path/lib\"\n++ fi\n++ AC_CHECK_HEADERS(pcre2.h,\n++ AC_CHECK_LIB(pcre2-8, pcre2_match_8,[pcre2=yes],[pcre2=no]),\n++ [pcre2=no]\n++ )\n++\n++ if test \"a$pcre2\" = \"ayes\"; then\n++ AC_DEFINE(HAVE_PCRE2,1,[Define HAVE_PCRE2 if pcre2 installed])\n++ ICFG_BUILD_FLAGS(PCRE2, \"$pcre2path\", \"-lpcre2-8\")\n++ fi\n++ ICFG_STATE_ROLLBACK\n++fi\n++\n+ # Check for PCRE regex library\n+ AC_ARG_WITH(pcre,\n+ [ --with-pcre Path to PCRE library],\n+@@ -670,7 +711,7 @@ case \"$withval\" in\n+ [ pcre=yes]\n+ )\n+ \n+-if test a\"$pcre\" != \"ano\"; then\n++if test a\"$pcre\" != \"ano\" -a a\"$pcre2\" != \"ayes\"; then\n+ ICFG_STATE_SAVE(PCRE)\n+ if test \"a$pcrepath\" != \"a\"; then\n+ CFLAGS=\"$CFLAGS -I$pcrepath/include\"\n+@@ -714,7 +755,7 @@ AC_CHECK_HEADERS(regex.h,\n+ )\n+ \n+ USE_REGEX=0\n+-if test \"a$pcre\" = \"ayes\" -o \"a$posix_regex\" = \"ayes\"; then\n++if test \"a$pcre2\" = \"ayes\" -o \"a$pcre\" = \"ayes\" -o \"a$posix_regex\" = \"ayes\"; then\n+ USE_REGEX=1\n+ fi\n+ AC_SUBST(USE_REGEX)\n+@@ -1001,7 +1042,9 @@ AM_CONDITIONAL(ISCYGWIN,[test a\"$iscygwin\" != a])\n+ # Now determine which modules will going to build .....\n+ \n+ AM_CONDITIONAL(USE_OPENSSL, [test a\"$openssl\" != \"ano\"])\n+-AM_CONDITIONAL(USE_REGEX, [test a\"$pcre\" = \"ayes\" -o a\"$posix_regex\" = \"ayes\"])\n++AM_CONDITIONAL(USE_PCRE2, [test a\"$pcre2\" = \"ayes\"])\n++AM_CONDITIONAL(USE_PCRE, [test a\"$pcre\" = \"ayes\"])\n++AM_CONDITIONAL(USE_REGEX, [test a\"$pcre2\" = \"ayes\" -o a\"$pcre\" = \"ayes\" -o a\"$posix_regex\" = \"ayes\"])\n+ AM_CONDITIONAL(USEPERL,[test a\"$perlcore\" != a])\n+ AM_CONDITIONAL(USEBDB, [test a\"$libdb\" != ano])\n+ AM_CONDITIONAL(USELDAP, [test a\"$libldap\" != ano])\n+diff --git a/include/ci_regex.h b/include/ci_regex.h\n+index 27afc9c..df7b77a 100644\n+--- a/include/ci_regex.h\n++++ b/include/ci_regex.h\n+@@ -33,18 +33,57 @@ struct ci_regex_match {\n+ size_t s;\n+ size_t e;\n+ };\n+-typedef struct ci_regex_match ci_regex_matches_t[10];\n++#define CI_REGEX_SUBMATCHES 10\n++typedef struct ci_regex_match ci_regex_matches_t[CI_REGEX_SUBMATCHES];\n+ typedef struct ci_regex_replace_part {\n+ const void *user_data;\n+ ci_regex_matches_t matches;\n+ } ci_regex_replace_part_t;\n+ \n+-#define ci_regex_create_match_list() ci_list_create(32768, sizeof(ci_regex_replace_part_t))\n++/**\n++ \\brief Builds a regex match list to store regex matches.\n++ * The regex match list is a ci_list_t object which stores ci_regex_replace_part\n++ * objects as items.\n++ \\ingroup UTILITY\n++ */\n++#define ci_regex_create_match_list() ci_list_create(1024, sizeof(ci_regex_replace_part_t))\n++\n++/**\n++ \\brief Parses a regex expresion having the form /regex/flags\n++ \\ingroup UTILITY\n++ *\n++ */\n+ CI_DECLARE_FUNC(char *) ci_regex_parse(const char *str, int *flags, int *recursive);\n++\n++/**\n++ \\brief Compiles a regex expresion into an internal form.\n++ \\param regex_str The regex string normally returned by ci_regex_parse function\n++ \\param regex_flags The regex flags built using the ci_regex_parse\n++ \\ingroup UTILITY\n++ */\n+ CI_DECLARE_FUNC(ci_regex_t) ci_regex_build(const char *regex_str, int regex_flags);\n++\n++/**\n++ * Releases objects built using the ci_regex_build\n++ \\ingroup UTILITY\n++ */\n+ CI_DECLARE_FUNC(void) ci_regex_free(ci_regex_t regex);\n++\n++/**\n++ * Matchs a compiled regex expresion of type ci_regex_t against the given string.\n++ \\param regex The compiled regex expresion\n++ \\param str The string to match against\n++ \\param len The str string length. For '\\0' terminated strings set it to -1\n++ \\param recurs If it is not NULL matches recursivelly\n++ \\param matches The regex match list to store matches. It can be NULL\n++ \\param user_data pointer to user data to store with matches in rege match list.\n++ \\ingroup UTILITY\n++ */\n+ CI_DECLARE_FUNC(int) ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs, ci_list_t *matches, const void *user_data);\n+ \n++\n++CI_DECLARE_FUNC(void) ci_regex_memory_init();\n++\n+ #ifdef __cplusplus\n+ }\n+ #endif\n+diff --git a/regex.c b/regex.c\n+index 82277df..de9b387 100644\n+--- a/regex.c\n++++ b/regex.c\n+@@ -1,14 +1,107 @@\n+ #include \"common.h\"\n+ #include \"debug.h\"\n+ #include \"array.h\"\n++#include \"mem.h\"\n+ #include \"ci_regex.h\"\n+ \n+-#ifdef HAVE_PCRE\n++#if defined(HAVE_PCRE2)\n++#define PCRE2_CODE_UNIT_WIDTH 8 // TODO: make it configurable via configure\n++#include <pcre2.h>\n++#elif defined(HAVE_PCRE)\n+ #include <pcre.h>\n+ #else\n+ #include <regex.h>\n+ #endif\n+ \n++#if defined(HAVE_PCRE2)\n++pcre2_general_context *pcre2GenContext = NULL;\n++pcre2_match_context *pcre2MatchContext = NULL;\n++\n++void *pcre2_malloc(PCRE2_SIZE size, void *udata)\n++{\n++ void *p = ci_buffer_alloc(size);\n++ return p;\n++}\n++\n++void pcre2_free(void *p, void *udata)\n++{\n++ ci_buffer_free(p);\n++}\n++\n++struct {\n++ char *name;\n++ uint32_t flag;\n++} pcre2_flags[] = {\n++ {\"ANCHORED\", 0x80000000u},\n++ {\"NO_UTF_CHECK\", 0x40000000u},\n++ {\"ENDANCHORED\", 0x20000000u},\n++ {\"ALLOW_EMPTY_CLASS\", 0x00000001u},\n++ {\"ALT_BSUX\", 0x00000002u},\n++ {\"AUTO_CALLOUT\", 0x00000004u},\n++ {\"CASELESS\", 0x00000008u},\n++ {\"DOLLAR_ENDONLY\", 0x00000010u},\n++ {\"DOTALL\", 0x00000020u},\n++ {\"DUPNAMES\", 0x00000040u},\n++ {\"EXTENDED\", 0x00000080u},\n++ {\"FIRSTLINE\", 0x00000100u},\n++ {\"MATCH_UNSET_BACKREF\", 0x00000200u},\n++ {\"MULTILINE\", 0x00000400u},\n++ {\"NEVER_UCP\", 0x00000800u},\n++ {\"NEVER_UTF\", 0x00001000u},\n++ {\"NO_AUTO_CAPTURE\", 0x00002000u},\n++ {\"NO_AUTO_POSSESS\", 0x00004000u},\n++ {\"NO_DOTSTAR_ANCHOR\", 0x00008000u},\n++ {\"NO_START_OPTIMIZE\", 0x00010000u},\n++ {\"UCP\", 0x00020000u},\n++ {\"UNGREEDY\", 0x00040000u},\n++ {\"UTF\", 0x00080000u},\n++ {\"NEVER_BACKSLASH_C\", 0x00100000u},\n++ {\"ALT_CIRCUMFLEX\", 0x00200000u},\n++ {\"ALT_VERBNAMES\", 0x00400000u},\n++ {\"USE_OFFSET_LIMIT\", 0x00800000u},\n++ {\"EXTENDED_MORE\", 0x01000000u},\n++ {\"LITERAL\", 0x02000000u},\n++ {\"MATCH_INVALID_UTF\", 0x04000000u},\n++ {NULL, 0}\n++};\n++\n++int pcre2_flag_parse(const char **f)\n++{\n++ const char *s = (*f);\n++ if (*s != '<')\n++ return 0;\n++ s++;\n++ const char *e = strchr(s, '>');\n++ if (e)\n++ *f = e;\n++ else {\n++ e = s + strlen(s);\n++ *f = e - 1;\n++ }\n++ size_t len = e - s;\n++ e--;\n++ if (!len)\n++ return 0;\n++\n++ int i;\n++ for (i = 0; pcre2_flags[i].name != NULL; i++) {\n++ if (strncmp(pcre2_flags[i].name, s, len) == 0)\n++ return pcre2_flags[i].flag;\n++ }\n++ return 0;\n++}\n++\n++#endif\n++\n++void ci_regex_memory_init()\n++{\n++#if defined(HAVE_PCRE2)\n++ pcre2GenContext = pcre2_general_context_create(pcre2_malloc, pcre2_free, NULL);\n++ pcre2MatchContext = pcre2_match_context_create(pcre2GenContext);\n++#endif\n++}\n++\n++\n+ \n+ char *ci_regex_parse(const char *str, int *flags, int *recursive)\n+ {\n+@@ -29,7 +122,10 @@ char *ci_regex_parse(const char *str, int *flags, int *recursive)\n+ s[slen] = '\\0';\n+ \n+ *flags = 0;\n+-#ifdef HAVE_PCRE\n++#if defined(HAVE_PCRE2)\n++ *flags |= PCRE2_NEWLINE_ANY;\n++ *flags |= PCRE2_NEWLINE_ANYCRLF;\n++#elif defined(HAVE_PCRE)\n+ *flags |= PCRE_NEWLINE_ANY;\n+ *flags |= PCRE_NEWLINE_ANYCRLF;\n+ #else\n+@@ -38,7 +134,27 @@ char *ci_regex_parse(const char *str, int *flags, int *recursive)\n+ #endif\n+ \n+ while (*e != '\\0') {\n+-#ifdef HAVE_PCRE\n++#if defined(HAVE_PCRE2)\n++ if (*e == 'i')\n++ *flags = *flags | PCRE2_CASELESS;\n++ else if (*e == 'm')\n++ *flags |= PCRE2_MULTILINE;\n++ else if (*e == 's')\n++ *flags |= PCRE2_DOTALL;\n++ else if (*e == 'x')\n++ *flags |= PCRE2_EXTENDED;\n++ else if (*e == 'A')\n++ *flags |= PCRE2_ANCHORED;\n++ else if (*e == 'D')\n++ *flags |= PCRE2_DOLLAR_ENDONLY;\n++ else if (*e == 'U')\n++ *flags |= PCRE2_UNGREEDY;\n++ else if (*e == 'u')\n++ *flags |= PCRE2_UTF | PCRE2_UCP;\n++ else if (*e == '<') {\n++ *flags |= pcre2_flag_parse(&e);\n++ }\n++#elif defined(HAVE_PCRE)\n+ if (*e == 'i')\n+ *flags = *flags | PCRE_CASELESS;\n+ else if (*e == 'm')\n+@@ -74,7 +190,19 @@ char *ci_regex_parse(const char *str, int *flags, int *recursive)\n+ \n+ ci_regex_t ci_regex_build(const char *regex_str, int regex_flags)\n+ {\n+-#ifdef HAVE_PCRE\n++#if defined(HAVE_PCRE2)\n++ pcre2_code *re;\n++ int errcode;\n++ PCRE2_SIZE erroffset;\n++ re = pcre2_compile((PCRE2_SPTR)regex_str, PCRE2_ZERO_TERMINATED, (uint32_t)regex_flags, &errcode, &erroffset, NULL);\n++ if (re == NULL) {\n++ PCRE2_UCHAR errbuf[256];\n++ pcre2_get_error_message(errcode, errbuf, sizeof(errbuf));\n++ ci_debug_printf(2, \"PCRE2 compilation of '%s' failed at offset %d: %s\\n\", regex_str, (int)erroffset, errbuf);\n++ return NULL;\n++ }\n++ return (ci_regex_t)re;\n++#elif defined(HAVE_PCRE)\n+ pcre *re;\n+ const char *error;\n+ int erroffset;\n+@@ -103,7 +231,9 @@ ci_regex_t ci_regex_build(const char *regex_str, int regex_flags)\n+ \n+ void ci_regex_free(ci_regex_t regex)\n+ {\n+-#ifdef HAVE_PCRE\n++#if defined(HAVE_PCRE2)\n++ pcre2_code_free((pcre2_code *)regex);\n++#elif defined(HAVE_PCRE)\n+ pcre_free((pcre *)regex);\n+ #else\n+ regfree((regex_t *)regex);\n+@@ -112,7 +242,7 @@ void ci_regex_free(ci_regex_t regex)\n+ }\n+ \n+ #ifdef HAVE_PCRE\n+-#define OVECCOUNT 30 /* should be a multiple of 3 */\n++#define OVECCOUNT (3*CI_REGEX_SUBMATCHES) /* should be a multiple of 3 */\n+ #endif\n+ \n+ int ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs, ci_list_t *matches, const void *user_data)\n+@@ -120,14 +250,42 @@ int ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs,\n+ int count = 0, i;\n+ ci_regex_replace_part_t parts;\n+ \n+- if (!str)\n++ if (!str || len == 0)\n+ return 0;\n+ \n+-#ifdef HAVE_PCRE\n++#if defined(HAVE_PCRE2)\n++ PCRE2_SIZE offset = 0;\n++ pcre2_match_data *match_data = pcre2_match_data_create_from_pattern(regex, pcre2GenContext);\n++ do {\n++ int str_length = len > 0 ? len : PCRE2_ZERO_TERMINATED;\n++ int rcaptures = pcre2_match(regex, (PCRE2_SPTR)str, str_length, offset, 0, match_data, pcre2MatchContext);\n++ if (rcaptures >= 0)\n++ count++;\n++ if (rcaptures > 0 && matches) {\n++ PCRE2_SIZE *ovector = pcre2_get_ovector_pointer(match_data);\n++ for (i = 0; i < rcaptures && i < CI_REGEX_SUBMATCHES; i++) {\n++ _CI_ASSERT(ovector[2*i+1] >= ovector[2*i]);\n++ if (matches) {\n++ parts.user_data = user_data;\n++ memset(parts.matches, 0, sizeof(ci_regex_matches_t));\n++ ci_debug_printf(9, \"\\t sub-match pattern (pos:%d-%d): '%.*s'\\n\", (int)ovector[2*i], (int)ovector[2*i+1], (int)(ovector[2*i + 1] - ovector[2*i]), str+ovector[2*i]);\n++ parts.matches[i].s = ovector[2*i];\n++ parts.matches[i].e = ovector[2*i+1];\n++ }\n++ ci_list_push_back(matches, (void *)&parts);\n++ }\n++ offset = ovector[1]; /*Assert that it is less than strlen(str)?*/\n++ } else if (rcaptures < 0) {\n++ /* maybe check and report the exact error?*/\n++ offset = 0;\n++ } /* the rcaptures==0 not possible for our case, but maybe check and warn?*/\n++ } while (recurs && offset > 0);\n++ pcre2_match_data_free(match_data);\n++#elif defined(HAVE_PCRE)\n+ int ovector[OVECCOUNT];\n+ int rc;\n+ int offset = 0;\n+- int str_length = len >=0 ? len : strlen(str);\n++ int str_length = len > 0 ? len : strlen(str);\n+ do {\n+ memset(ovector, 0, sizeof(ovector));\n+ rc = pcre_exec(regex, NULL, str, str_length, offset, 0, ovector, OVECCOUNT);\n+@@ -139,7 +297,7 @@ int ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs,\n+ if (matches) {\n+ parts.user_data = user_data;\n+ memset(parts.matches, 0, sizeof(ci_regex_matches_t));\n+- for (i = 0; i < 10 && ovector[2*i+1] > ovector[2*i]; ++i) {\n++ for (i = 0; i < CI_REGEX_SUBMATCHES && ovector[2*i+1] > ovector[2*i]; ++i) {\n+ ci_debug_printf(9, \"\\t sub-match pattern (pos:%d-%d): '%.*s'\\n\", ovector[2*i], ovector[2*i+1], ovector[2*i + 1] - ovector[2*i], str+ovector[2*i]);\n+ parts.matches[i].s = ovector[2*i];\n+ parts.matches[i].e = ovector[2*i+1];\n+@@ -151,17 +309,27 @@ int ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs,\n+ \n+ #else\n+ int retcode;\n+- regmatch_t pmatch[10];\n++ regmatch_t pmatch[CI_REGEX_SUBMATCHES];\n++ char *tmpS = NULL;\n++ const char *s;\n++ if (len > 0 && len < strlen(str)) {\n++ tmpS = ci_buffer_alloc(len + 1);\n++ _CI_ASSERT(tmpS);\n++ memcpy(tmpS, str, len);\n++ tmpS[len] = '\\0';\n++ s = tmpS;\n++ } else\n++ s = str;\n+ do {\n+- if ((retcode = regexec(regex, str, 10, pmatch, 0)) == 0) {\n++ if ((retcode = regexec(regex, s, CI_REGEX_SUBMATCHES, pmatch, 0)) == 0) {\n+ ++count;\n+- ci_debug_printf(9, \"Match pattern (pos:%d-%d): '%.*s'\\n\", pmatch[0].rm_so, pmatch[0].rm_eo, pmatch[0].rm_eo - pmatch[0].rm_so, str+pmatch[0].rm_so);\n++ ci_debug_printf(9, \"Match pattern (pos:%d-%d): '%.*s'\\n\", pmatch[0].rm_so, pmatch[0].rm_eo, pmatch[0].rm_eo - pmatch[0].rm_so, s+pmatch[0].rm_so);\n+ \n+ if (matches) {\n+ parts.user_data = user_data;\n+ memset(parts.matches, 0, sizeof(ci_regex_matches_t));\n+- for (i = 0; i < 10 && pmatch[i].rm_eo > pmatch[i].rm_so; ++i) {\n+- ci_debug_printf(9, \"\\t sub-match pattern (pos:%d-%d): '%.*s'\\n\", pmatch[i].rm_so, pmatch[i].rm_eo, pmatch[i].rm_eo - pmatch[i].rm_so, str+pmatch[i].rm_so);\n++ for (i = 0; i < CI_REGEX_SUBMATCHES && pmatch[i].rm_eo > pmatch[i].rm_so; ++i) {\n++ ci_debug_printf(9, \"\\t sub-match pattern (pos:%d-%d): '%.*s'\\n\", pmatch[i].rm_so, pmatch[i].rm_eo, pmatch[i].rm_eo - pmatch[i].rm_so, s+pmatch[i].rm_so);\n+ parts.matches[i].s = pmatch[i].rm_so;\n+ parts.matches[i].e = pmatch[i].rm_eo;\n+ }\n+@@ -169,14 +337,16 @@ int ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs,\n+ }\n+ \n+ if (pmatch[0].rm_so >= 0 && pmatch[0].rm_eo >= 0 && pmatch[0].rm_so != pmatch[0].rm_eo) {\n+- str += pmatch[0].rm_eo;\n+- ci_debug_printf(8, \"I will check again starting from: %s\\n\", str);\n++ s += pmatch[0].rm_eo;\n++ ci_debug_printf(8, \"I will check again starting from: %s\\n\", s);\n+ } else /*stop here*/\n+- str = NULL;\n++ s = NULL;\n+ }\n+- } while (recurs && str && *str != '\\0' && retcode == 0);\n++ } while (recurs && s && *s != '\\0' && retcode == 0);\n++ if (tmpS)\n++ ci_buffer_free(tmpS);\n+ #endif\n+ \n+- ci_debug_printf(5, \"ci_regex_apply matches count: %d\\n\", count);\n++ ci_debug_printf(5, \"ci_regex_apply string '%s' matches count: %d\\n\", str, count);\n+ return count;\n+ }\n+diff --git a/types_ops.c b/types_ops.c\n+index 78798c6..1310d4b 100644\n+--- a/types_ops.c\n++++ b/types_ops.c\n+@@ -273,7 +273,7 @@ int regex_cmp(const void *key1, const void *key2)\n+ struct ci_acl_regex *reg = (struct ci_acl_regex *)key1;\n+ if (!key2)\n+ return -1;\n+- return (ci_regex_apply(reg->preg, (const char *)key2, strlen(key2), 0, NULL, NULL) == 0 ? 1 : 0);\n++ return (ci_regex_apply(reg->preg, (const char *)key2, -1, 0, NULL, NULL) == 0 ? 1 : 0);\n+ }\n+ \n+ int regex_equal(const void *key1, const void *key2)\n+@@ -281,7 +281,7 @@ int regex_equal(const void *key1, const void *key2)\n+ struct ci_acl_regex *reg = (struct ci_acl_regex *)key1;\n+ if (!key2)\n+ return 0;\n+- return ci_regex_apply(reg->preg, (const char *)key2, strlen(key2), 0, NULL, NULL) != 0;\n++ return ci_regex_apply(reg->preg, (const char *)key2, -1, 0, NULL, NULL) != 0;\n+ }\n+ \n+ size_t regex_len(const void *key)\ndiff --git a/package/c-icap/0007-Add-missing-_CI_ASSERT-macro-for-pcre2-patch.patch b/package/c-icap/0007-Add-missing-_CI_ASSERT-macro-for-pcre2-patch.patch\nnew file mode 100644\nindex 0000000000..0209722a16\n--- /dev/null\n+++ b/package/c-icap/0007-Add-missing-_CI_ASSERT-macro-for-pcre2-patch.patch\n@@ -0,0 +1,50 @@\n+From: Boyuan Yang <byang@debian.org>\n+Date: Sat, 29 Jul 2023 19:34:51 -0400\n+Subject: Add missing _CI_ASSERT macro for pcre2 patch\n+\n+Upstream: https://github.com/c-icap/c-icap-server/commit/9d4b75b2a044669cbe4570f95f0f8f00f09b0d21\n+\n+Downloaded from\n+https://sources.debian.org/src/c-icap/1%3A0.5.10-7/debian/patches/0007-Add-missing-_CI_ASSERT-macro-for-pcre2-patch.patch\n+\n+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>\n+---\n+ debug.c | 10 ++++++++++\n+ include/debug.h | 3 +++\n+ 2 files changed, 13 insertions(+)\n+\n+diff --git a/debug.c b/debug.c\n+index 8a3bf6d..4f34a87 100644\n+--- a/debug.c\n++++ b/debug.c\n+@@ -47,6 +47,16 @@ void __ldebug_printf(int i, const char *format, ...)\n+ }\n+ #endif\n+ \n++void ci_debug_abort(const char *file, int line, const char *function, const char *mesg)\n++{\n++ ci_debug_printf(1, \"Abort at %s, %d, %s: \\'%s\\'\\n\", file, line, function, mesg);\n++ fflush(stderr);\n++ fflush(stdout);\n++ abort();\n++}\n++\n++void (*__ci_debug_abort)(const char *file, int line, const char *function, const char *mesg) = ci_debug_abort;\n++\n+ /*\n+ void debug_print_request(ci_request_t *req){\n+ int i,j;\n+diff --git a/include/debug.h b/include/debug.h\n+index 9373ec9..990cce7 100644\n+--- a/include/debug.h\n++++ b/include/debug.h\n+@@ -44,6 +44,9 @@ CI_DECLARE_DATA extern void (*__log_error)(void *req, const char *format,... );\n+ #define ci_debug_printf(i, args...) if(i<=CI_DEBUG_LEVEL){ if(__log_error) (*__log_error)(NULL,args); if(CI_DEBUG_STDOUT) printf(args);}\n+ #endif\n+ \n++CI_DECLARE_DATA extern void (*__ci_debug_abort)(const char *file, int line, const char *function, const char *mesg);\n++#define _CI_ASSERT(expression) {if (!(expression)) (*__ci_debug_abort)(__FILE__, __LINE__, __func__, #expression);}\n++\n+ #ifdef __cplusplus\n+ }\n+ #endif\ndiff --git a/package/c-icap/c-icap.mk b/package/c-icap/c-icap.mk\nindex 7e1b73cd2e..ee351d9781 100644\n--- a/package/c-icap/c-icap.mk\n+++ b/package/c-icap/c-icap.mk\n@@ -13,6 +13,7 @@ C_ICAP_CPE_ID_VALID = YES\n C_ICAP_INSTALL_STAGING = YES\n C_ICAP_CONFIG_SCRIPTS = c-icap-config c-icap-libicapapi-config\n C_ICAP_CONF_OPTS = \\\n+\t--without-pcre \\\n \t--without-perl \\\n \t--without-zstd \\\n \t--enable-large-files \\\n@@ -63,11 +64,11 @@ else\n C_ICAP_CONF_OPTS += --without-openssl\n endif\n \n-ifeq ($(BR2_PACKAGE_PCRE),y)\n-C_ICAP_CONF_OPTS += --with-pcre\n-C_ICAP_DEPENDENCIES += pcre\n+ifeq ($(BR2_PACKAGE_PCRE2),y)\n+C_ICAP_CONF_OPTS += --with-pcre2\n+C_ICAP_DEPENDENCIES += pcre2\n else\n-C_ICAP_CONF_OPTS += --without-pcre\n+C_ICAP_CONF_OPTS += --without-pcre2\n endif\n \n ifeq ($(BR2_PACKAGE_ZLIB),y)\n", "prefixes": [ "4/4" ] }