Welcome! Log In Create A New Profile

Advanced

Re: [PATCH 2 of 2] Added config path when unknown variable error occurs

Maxim Dounin
February 09, 2023 03:22AM
Hello!

On Wed, Feb 08, 2023 at 06:54:07PM +0300, Safar Safarly via nginx-devel wrote:

> # HG changeset patch
> # User Safar Safarly <hafl@me.com>
> # Date 1675853769 -10800
> # Wed Feb 08 13:56:09 2023 +0300
> # Node ID 1396218aa1296ffc9776644534a1541b78a460a0
> # Parent 55553146bd984be7e9e3bbfa851c282feda82d93
> Added config path when unknown variable error occurs
>
> Previously, when unknown variable occured, error was logged with
> ngx_log_error():
>
> nginx: [emerg] unknown "rate" variable
>
> instead of ngx_conf_log_error():
>
> nginx: [emerg] unknown "rate" variable in /conf/nginx.conf:27
>
> diff -r 55553146bd98 -r 1396218aa129 src/http/ngx_http_variables.c
> --- a/src/http/ngx_http_variables.c Tue Feb 07 17:24:26 2023 +0300
> +++ b/src/http/ngx_http_variables.c Wed Feb 08 13:56:09 2023 +0300
> @@ -2792,8 +2792,8 @@
> }
>
> if (v[i].get_handler == NULL) {
> - ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
> - "unknown \"%V\" variable", &v[i].name);
> + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
> + "unknown \"%V\" variable", &v[i].name);
>
> return NGX_ERROR;
> }
> diff -r 55553146bd98 -r 1396218aa129 src/stream/ngx_stream_variables.c
> --- a/src/stream/ngx_stream_variables.c Tue Feb 07 17:24:26 2023 +0300
> +++ b/src/stream/ngx_stream_variables.c Wed Feb 08 13:56:09 2023 +0300
> @@ -1277,8 +1277,8 @@
> }
>
> if (v[i].get_handler == NULL) {
> - ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
> - "unknown \"%V\" variable", &v[i].name);
> + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
> + "unknown \"%V\" variable", &v[i].name);
> return NGX_ERROR;
> }
>

The ngx_http_variables_init_vars() function you are patching is
called when the http block is fully parsed, and therefore
ngx_conf_log_error() will always point to the end of the http
block. This provides no usable information, so ngx_log_error() is
used instead.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 1 of 2] Core: connect() error log message made more verbose

Safar Safarly via nginx-devel 630 February 08, 2023 10:56AM

[PATCH 2 of 2] Added config path when unknown variable error occurs

Safar Safarly via nginx-devel 99 February 08, 2023 10:56AM

Re: [PATCH 2 of 2] Added config path when unknown variable error occurs

Maxim Dounin 116 February 09, 2023 03:22AM

Re: [PATCH 1 of 2] Core: connect() error log message made more verbose

Maxim Dounin 120 February 09, 2023 03:12AM

Re: [PATCH 1 of 2] Core: connect() error log message made more verbose

Sergey Kandaurov 109 February 22, 2023 06:38AM

Re: [PATCH 1 of 2] Core: connect() error log message made more verbose

Maxim Dounin 110 February 22, 2023 02:56PM

Re: [PATCH 1 of 2] Core: connect() error log message made more verbose

Sergey Kandaurov 98 March 09, 2023 11:08AM

Re: [PATCH 1 of 2] Core: connect() error log message made more verbose

Maxim Dounin 118 March 09, 2023 11:54PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready