Skip to content

Commit 1d9dd4b

Browse files
committed
fix: work around configure issue with GCC 14+
See owasp-modsecurity/ModSecurity-nginx#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.
1 parent 60421a8 commit 1d9dd4b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nginx/Dockerfile-alpine

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ RUN set -eux; \
5353
make -j$(nproc) install; \
5454
strip /usr/local/modsecurity/lib/lib*.so*
5555

56-
# Build modules
56+
# Build modules
57+
# Note the `sed` line. It patches the configure test for ModSecurity-nginx
58+
# so that it works with GCC 14+.
59+
# Once https://github.com/owasp-modsecurity/ModSecurity-nginx/pull/275 has
60+
# been released, this workaround can be removed again.
5761
RUN set -eux; \
5862
modules=""; \
5963
set -- ${NGINX_DYNAMIC_MODULES}; \
@@ -66,6 +70,7 @@ RUN set -eux; \
6670
git clone -b "${version}" --depth 1 "https://github.com/${owner}/${name}.git"; \
6771
modules="${modules} --add-dynamic-module=../${name}"; \
6872
done; \
73+
sed -iE "s/ngx_feature_test='printf(\"hello\");'/ngx_feature_test='msc_init();'/" ModSecurity-nginx/config; \
6974
curl -sSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -o nginx-${NGINX_VERSION}.tar.gz; \
7075
tar -xzf nginx-${NGINX_VERSION}.tar.gz; \
7176
cd ./nginx-${NGINX_VERSION}; \

0 commit comments

Comments
 (0)