Opened 8 weeks ago

#2669 new defect

Problems with using the $ sign in third-party modules in regexp templates

Reported by: volga.leoking@… Owned by:
Priority: minor Milestone:
Component: documentation Version: 1.25.x
Keywords: Cc:
uname -a: Linux stage-balancer01r 6.5.0-21-generic #21~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 9 13:32:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx -V
nginx version: nginx/1.26.1
built by gcc 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
built with OpenSSL 3.0.2 15 Mar 2022
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/opt/NGINX/nginx-1.26.1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-headers-more-filter --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-auth-pam --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-cache-purge --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-dav-ext --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-ndk --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-echo --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-fancyindex --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-geoip2 --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/nchan --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-lua --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/rtmp --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-uploadprogress --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-upstream-fair --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-subs-filter --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-set-misc --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-encrypted-session --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-vod --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/http-njs/nginx --add-dynamic-module=/opt/NGINX/nginx-1.26.1/modules/ssl-ct

Description

Previously, the configuration in nginx 1.22.0 was used with the lines:

subs_filter '?t=$Time$' g;
subs_filter '#EXT-X-MEDIA.+TYPE=SUBTITLES.+\n$'
rg;

but when switching to nginx version 1.26.1, errors began to appear as follows:
nginx: [emerg] invalid variable name in /etc/nginx/...
and
nginx: [emerg] match part cannot contain variable during regex made in /etc/nginx/...

in the process of studying the problem, it was revealed that the $ symbol was to blame, but any attempts at escaping did not lead to success.

Only after changing regexp templates:

subs_filter '\?t=.Time.' rg;
subs_filter '#EXT-X-MEDIA.+TYPE=SUBTITLES.+\n'
rg;

the configuration was started successfully.

Please comment on this behavior and will it be possible to use $ in the regexp template in third-party modules in the future?

Change History (0)

Note: See TracTickets for help on using tickets.