Opened 8 weeks ago

#2670 new defect

Экранирование $ в конфигурации сторонних модулей

Reported by: volga.leoking@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version:
Keywords: Cc:
uname -a: Linux test_nginx_1.26 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 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

Ранее использовалась конфигурация в nginx 1.22.0 со строками:

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

но при переходе на версию nginx 1.26.1 стали получать ошибки следующего содержания:
nginx: [emerg] invalid variable name in /etc/nginx/...
и
nginx: [emerg] match part cannot contain variable during regex mode in /etc/nginx/...

в процессе изучения проблемы выявили что виной тому символ $, но любые попытки экранирования не приводили к успеху.

Только после изменения regexp шаблонов:

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

удалось запустить конфигурацию.

Просьба прокоментировать данное поведение и будет ли возможность в дальнейшем спользовать $ в regexp шаблоне в сторонних модулях?
Экранирование в виде $$, \$ не работает!

Change History (0)

Note: See TracTickets for help on using tickets.