Opened 7 years ago
Closed 7 years ago
#1379 closed defect (fixed)
nginx-tests/access_log.t failed
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | other | Version: | 1.13.x |
Keywords: | nginx test | Cc: | |
uname -a: | Linux vm-mock2 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.13.0
built by gcc 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC) built with OpenSSL 1.0.2k 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --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 --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-openssl=openssl-OpenSSL_1_0_2k --add-module=/home/mok/rpmbuild/BUILD/nginx-1.13.0/ngx_devel_kit-0.3.0 --add-module=nginx-goodies-nginx-sticky-module-ng-08a395c66e42 --add-module=/home/mok/rpmbuild/BUILD/nginx-1.13.0/lua-nginx-module-0.10.9rc1 --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt=-fPIC |
Description
previously this built passed tests but not now
nginx -V see in specific field
last version of nginx also don't pass
prove -r nginx-tests
nginx-tests/access_log.t ......................... 1/17
# Failed test 'cache - closed lru'
# at nginx-tests/access_log.t line 246.
# got: '3'
# expected: '2'
# Failed test 'cache - min_uses'
# at nginx-tests/access_log.t line 247.
# got: '2'
# expected: '1'
# Looks like you failed 2 tests of 17.
nginx-tests/access_log.t ......................... Dubious, test returned 2 (wstat 512, 0x200)
Change History (4)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
what's wrong with running tests under root ?
here's detailed script how to reproduce the error with official nginx rpm (centos 7)
yum install perl-Test-Harness perl-Test-Simple perl-IO-Socket-SSL perl-IO-Zlib git clone https://github.com/nginx/nginx-tests export TEST_NGINX_BINARY=`which nginx` export TEST_NGINX_MODULES=/usr/lib64/nginx/modules export TEST_NGINX_GLOBALS="user root root;" cd nginx-tests prove -v ./access_log.t # prove -v ./access_log.t ./access_log.t .. 1..17 ok 1 - compressed log - flush time ok 2 - default log format ok 3 - log filtering ok 4 - if with complex value ok 5 - log filtering with buffering ok 6 - multiple logs 1 ok 7 - multiple logs 2 ok 8 - long line format ok 9 - varlog literal zero name ok 10 - varlog good name ok 11 - binary not ok 12 - cache - closed lru not ok 13 - cache - min_uses ok 14 - cache - cached 1 ok 15 - cache - cached 2 ok 16 - no alerts ok 17 - no sanitizer errors # Failed test 'cache - closed lru' # at ./access_log.t line 246. # got: '3' # expected: '2' # Failed test 'cache - min_uses' # at ./access_log.t line 247. # got: '2' # expected: '1' 2017/09/07 19:23:53 [notice] 34856#34856: using the "epoll" event method 2017/09/07 19:23:53 [notice] 34856#34856: nginx/1.13.5 2017/09/07 19:23:53 [notice] 34856#34856: built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) 2017/09/07 19:23:53 [notice] 34856#34856: OS: Linux 3.10.0-514.26.2.el7.x86_64 2017/09/07 19:23:53 [notice] 34856#34856: getrlimit(RLIMIT_NOFILE): 1024:4096 2017/09/07 19:23:53 [notice] 34856#34856: start worker processes 2017/09/07 19:23:53 [notice] 34856#34856: start worker process 34857 2017/09/07 19:23:53 [error] 34857#34857: *26 open() "/tmp/nginx-test-djCo6vyrTH/binary" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /binary HTTP/1.0", host: "localhost" 2017/09/07 19:23:53 [notice] 34856#34856: signal 3 (SIGQUIT) received from 34854, shutting down 2017/09/07 19:23:53 [notice] 34857#34857: gracefully shutting down 2017/09/07 19:23:53 [notice] 34857#34857: exiting 2017/09/07 19:23:53 [notice] 34857#34857: exit 2017/09/07 19:23:53 [notice] 34856#34856: signal 17 (SIGCHLD) received from 34857 2017/09/07 19:23:53 [notice] 34856#34856: worker process 34857 exited with code 0 2017/09/07 19:23:53 [notice] 34856#34856: exit # Looks like you failed 2 tests of 17. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/17 subtests Test Summary Report ------------------- ./access_log.t (Wstat: 512 Tests: 17 Failed: 2) Failed tests: 12-13 Non-zero exit status: 2 Files=1, Tests=17, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.07 cusr 0.02 csys = 0.12 CPU) Result: FAIL # cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) # nginx -V nginx version: nginx/1.13.5 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --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 --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
comment:3 by , 7 years ago
The problem here is that root user is able to read and write files regardless of their access mode. This test uses chmod(0000)
to prevent writing additional log files after some were cached by open_log_file_cache
, and hence will not work under root even with TEST_NGINX_GLOBALS="user root root;"
.
Are there any specific reasons you are trying to run tests under root? Tests are designed to be run under an unprivileged user, and running them under root is not expected to work (as you can see, most of them simply fail without TEST_NGINX_GLOBALS="user root root;"
manually specified).
comment:4 by , 7 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Make sure you don't run tests under root so that restricted file access mode not bypassed.