From 1d9dd4b73f32ac90899b1aebf0848ef446c38478 Mon Sep 17 00:00:00 2001 From: Max Leske <250711+theseion@users.noreply.github.com> Date: Sat, 26 Apr 2025 18:32:07 +0200 Subject: [PATCH] fix: work around configure issue with GCC 14+ See https://github.com/owasp-modsecurity/ModSecurity-nginx/pull/275. ModSecurity-nginx uses `printf` as part of the nginx configure test. As of GCC 14, this leads to an error during compilation and thus to an error when running `configure` on nginx. This commit works around the issue by patching the `config` file in ModSecurity-nginx with a valid value for. --- nginx/Dockerfile-alpine | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nginx/Dockerfile-alpine b/nginx/Dockerfile-alpine index 699430d..2d10b08 100644 --- a/nginx/Dockerfile-alpine +++ b/nginx/Dockerfile-alpine @@ -53,7 +53,11 @@ RUN set -eux; \ make -j$(nproc) install; \ strip /usr/local/modsecurity/lib/lib*.so* - # Build modules +# Build modules +# Note the `sed` line. It patches the configure test for ModSecurity-nginx +# so that it works with GCC 14+. +# Once https://github.com/owasp-modsecurity/ModSecurity-nginx/pull/275 has +# been released, this workaround can be removed again. RUN set -eux; \ modules=""; \ set -- ${NGINX_DYNAMIC_MODULES}; \ @@ -66,6 +70,7 @@ RUN set -eux; \ git clone -b "${version}" --depth 1 "https://github.com/${owner}/${name}.git"; \ modules="${modules} --add-dynamic-module=../${name}"; \ done; \ + sed -iE "s/ngx_feature_test='printf(\"hello\");'/ngx_feature_test='msc_init();'/" ModSecurity-nginx/config; \ curl -sSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -o nginx-${NGINX_VERSION}.tar.gz; \ tar -xzf nginx-${NGINX_VERSION}.tar.gz; \ cd ./nginx-${NGINX_VERSION}; \