vozlt/nginx-module-vts

Broken on 1.20.x ?

FlurryNight opened this issue · 9 comments

Hello

Trying to build with nginx 1.20.2 but fails to build

Output:


In file included from src/core/ngx_core.h:53,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
In function ‘ngx_write_fd’,
    inlined from ‘ngx_http_vhost_traffic_status_dump_node_write’ at /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:118:16:
src/os/unix/ngx_files.h:147:12: error: ‘write’ reading 3480 bytes from a region of size 1 [-Werror=stringop-overread]
  147 |     return write(fd, buf, n);
      |            ^~~~~~~~~~~~~~~~~
In file included from src/core/ngx_core.h:49,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
src/os/unix/ngx_files.h: In function ‘ngx_http_vhost_traffic_status_dump_node_write’:
src/core/ngx_rbtree.h:27:28: note: source object ‘color’ of size 1
   27 |     u_char                 color;
      |                            ^~~~~
In file included from src/os/unix/ngx_linux_config.h:20,
                 from src/core/ngx_config.h:26,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:12,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
/usr/include/unistd.h:378:16: note: in a call to function ‘write’ declared with attribute ‘access (read_only, 2, 3)’
  378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
      |                ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1516: objs/addon/src/ngx_http_vhost_traffic_status_dump.o] Error 1
make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.20.1'
make: *** [Makefile:10: build] Error 2
make -f objs/Makefile install


Thanks :)

This module does not have any problem with 1.20.2, I can build fine.

Please provide exact steps you're executing to build this module.

Also I'm using -Werror on build, you may want to try that.

Hello , @aminvakil

Thanks for your response.

Going to try again

Get back to you later

Hi,

Same with -Werror

Configuration summary
  + using threads
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/etc/nginx"
  nginx binary file: "/usr/sbin/nginx"
  nginx modules path: "/etc/nginx/modules"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/cache/nginx/client_temp"
  nginx http proxy temporary files: "/var/cache/nginx/proxy_temp"
  nginx http fastcgi temporary files: "/var/cache/nginx/fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

make -f objs/Makefile
make[1]: Entering directory '/usr/local/src/nginx/nginx-1.20.2'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -Wno-ignored-qualifiers -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
        -o objs/src/core/nginx.o \
        src/core/nginx.c

....

In file included from src/core/ngx_core.h:53,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
In function ‘ngx_write_fd’,
    inlined from ‘ngx_http_vhost_traffic_status_dump_node_write’ at /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:118:16:
src/os/unix/ngx_files.h:147:12: error: ‘write’ reading 3480 bytes from a region of size 1 [-Werror=stringop-overread]
  147 |     return write(fd, buf, n);
      |            ^~~~~~~~~~~~~~~~~
In file included from src/core/ngx_core.h:49,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
src/os/unix/ngx_files.h: In function ‘ngx_http_vhost_traffic_status_dump_node_write’:
src/core/ngx_rbtree.h:27:28: note: source object ‘color’ of size 1
   27 |     u_char                 color;
      |                            ^~~~~
In file included from src/os/unix/ngx_linux_config.h:20,
                 from src/core/ngx_config.h:26,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:12,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
/usr/include/unistd.h:378:16: note: in a call to function ‘write’ declared with attribute ‘access (read_only, 2, 3)’
  378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
      |                ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1516: objs/addon/src/ngx_http_vhost_traffic_status_dump.o] Error 1
make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.20.2'
make: *** [Makefile:10: build] Error 2
make -f objs/Makefile install
make[1]: Entering directory '/usr/local/src/nginx/nginx-1.20.2'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -Wno-ignored-qualifiers  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules -I src/http/v2 \
        -o objs/addon/src/ngx_http_vhost_traffic_status_dump.o \
        /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c
In file included from src/core/ngx_core.h:53,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
In function ‘ngx_write_fd’,
    inlined from ‘ngx_http_vhost_traffic_status_dump_node_write’ at /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:118:16:
src/os/unix/ngx_files.h:147:12: error: ‘write’ reading 3480 bytes from a region of size 1 [-Werror=stringop-overread]
  147 |     return write(fd, buf, n);
      |            ^~~~~~~~~~~~~~~~~
In file included from src/core/ngx_core.h:49,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
src/os/unix/ngx_files.h: In function ‘ngx_http_vhost_traffic_status_dump_node_write’:
src/core/ngx_rbtree.h:27:28: note: source object ‘color’ of size 1
   27 |     u_char                 color;
      |                            ^~~~~
In file included from src/os/unix/ngx_linux_config.h:20,
                 from src/core/ngx_config.h:26,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:12,
                 from /usr/local/src/nginx/modules/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
/usr/include/unistd.h:378:16: note: in a call to function ‘write’ declared with attribute ‘access (read_only, 2, 3)’
  378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
      |                ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1516: objs/addon/src/ngx_http_vhost_traffic_status_dump.o] Error 1
make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.20.2'
make: *** [Makefile:13: install] Error 2

My ./configure
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --user=nginx --group=nginx --with-cc-opt=-Wno-deprecated-declarations --with-cc-opt=-Werror --with-cc-opt=-Wno-ignored-qualifiers --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_mp4_module --with-http_auth_request_module --with-http_slice_module --with-http_stub_status_module --with-http_realip_module --with-http_sub_module --add-module=/usr/local/src/nginx/modules/nginx-module-vts

You possibly want to add --with-cc-opt=-Wno-stringop-overread, like you have for ignored-qualifiers.

Thanks @SquidDev

Nothing ...

same output, I have GCC v11 maybe is that?

People reporting that too

Okay, never mind xD,

Rebooted the testing VM, built with --with-cc-opt=-Wno-stringop-overread and worked

Testing to see if everything is okay

Everything okay!!

Thank you
@SquidDev
@aminvakil

vozlt commented

@FlurryNight I fixed in #232 (comment).

Awesome, Thank you!