Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statusmap is tested but not included in CGIEXTRAS #881

Open
jsoref opened this issue Sep 13, 2022 · 0 comments
Open

statusmap is tested but not included in CGIEXTRAS #881

jsoref opened this issue Sep 13, 2022 · 0 comments

Comments

@jsoref
Copy link
Contributor

jsoref commented Sep 13, 2022

nagios 4.4.6

nagios 4.4.6

setup

curl -LO https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.6.tar.gz
tar zxf nagios-4.4.6.tar.gz
cd nagioscore-nagios-4.4.6/
../nagios-4.4.4/config.status  --config
# '--enable-libtap'
./configure --enable-libtap
make -j all

test

$ make test
cd ./base && make
make[1]: Entering directory '/home/jsoref/nagioscore-nagios-4.4.6/base'
make -C ../lib
make[2]: Entering directory '/home/jsoref/nagioscore-nagios-4.4.6/lib'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/jsoref/nagioscore-nagios-4.4.6/lib'
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -o nagios nagios.o broker.o nebmods.o ../common/shared.o  query-handler.o workers.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o utils.o retention-base.o xretention-base.o comments-base.o xcomments-base.o objects-base.o xobjects-base.o statusdata-base.o xstatusdata-base.o perfdata-base.o xperfdata-base.o downtime-base.o  -Wl,-export-dynamic   -lm  -ldl  ../lib/libnagios.a
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -o nagiostats nagiostats.c  -lm  ../lib/libnagios.a
make[1]: Leaving directory '/home/jsoref/nagioscore-nagios-4.4.6/base'
cd ./cgi && make
make[1]: Entering directory '/home/jsoref/nagioscore-nagios-4.4.6/cgi'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/jsoref/nagioscore-nagios-4.4.6/cgi'
cd ./lib && make test
make[1]: Entering directory '/home/jsoref/nagioscore-nagios-4.4.6/lib'
test-squeue:
### squeue tests
Test results: 390647 passed, 0 failed

test-kvvec:
### key/value vector tests
Test results: 59 passed, 0 failed

test-iocache:
### iocache_use_delim() test
  ### Testing delimiter of len 1
  ### Testing delimiter of len 2
  ### Testing delimiter of len 7
  ### Testing delimiter of len 25
Test results: 52 passed, 0 failed

test-iobroker:
### iobroker ipc test
Test results: 6003 passed, 0 failed

test-bitmap:
### bitmap tests
Test results: 57 passed, 0 failed

test-dkhash:
### dkhash basic test
Test results: 12 passed, 0 failed
### dkhash_walk_data() test
Test results: 27 passed, 0 failed
### dkhash single bucket add remove forward
Test results: 10 passed, 0 failed
### dkhash single bucket add remove backward
Test results: 9 passed, 0 failed

test-runcmd:
### exec output comparison
Test results: 16 passed, 0 failed
### anomaly detection
Test results: 36 passed, 0 failed
### argument splitting
Test results: 51 passed, 0 failed

test-nsutils:
### tv_delta tests
  PASS tv_delta_msec()
  PASS tv_delta_f() * 1000 is 2.50 and should be 2.5
  PASS mkstr() must build proper strings
  PASS 2 online cpus detected
Test results: 4 passed, 0 failed

test-fanout:
### fanout tests
Test results: 1119 passed, 0 failed

make[1]: Leaving directory '/home/jsoref/nagioscore-nagios-4.4.6/lib'
make test-perl
make[1]: Entering directory '/home/jsoref/nagioscore-nagios-4.4.6'
cd ./cgi && make
make[2]: Entering directory '/home/jsoref/nagioscore-nagios-4.4.6/cgi'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/jsoref/nagioscore-nagios-4.4.6/cgi'
cd t && make test
make[2]: Entering directory '/home/jsoref/nagioscore-nagios-4.4.6/t'
prove *.t
610cgistatus.t .................. ok
611cgistatus-hosturgencies.t .... ok
615cgierror.t ................... ok
616cginotification.t ............ ok
617statuswml.t .................. ok
618cgisecurity.t ................ sh: 1: /home/jsoref/nagioscore-nagios-4.4.6/t/../cgi/statusmap.cgi: not found
618cgisecurity.t ................ 1/?
#   Failed test 'Expected escaping of quotes'
#   at 618cgisecurity.t line 21.
#                   ''
#     doesn't match '(?^:' style=xss:expression(alert('XSS')) ')'
#
# Looks like you failed 1 test of 3.
618cgisecurity.t ................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
622extinfo-local.t .............. ok
623cmd-local.t .................. ok
660status-downtimes-comments.t .. ok
705nagiostats.t ................. ok
900-configparsing.t ............. ok
910-noservice.t ................. ok
920-nocontactgroup.t ............ ok
930-emptygroups.t ............... ok

Test Summary Report
-------------------
618cgisecurity.t              (Wstat: 256 Tests: 3 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
Files=14, Tests=475,  6 wallclock secs ( 0.08 usr  0.03 sys +  5.72 cusr  0.54 csys =  6.37 CPU)
Result: FAIL
make[2]: *** [Makefile:6: test] Error 1
make[2]: Leaving directory '/home/jsoref/nagioscore-nagios-4.4.6/t'
make[1]: *** [Makefile:253: test-perl] Error 2
make[1]: Leaving directory '/home/jsoref/nagioscore-nagios-4.4.6'
make: *** [Makefile:239: test] Error 2

Debug

$ grep -r CGIEXTRAS .
./configure.ac:	CGIEXTRAS="$CGIEXTRAS statuswrl.cgi"
./configure.ac:			CGIEXTRAS="$CGIEXTRAS statusmap.cgi"
./configure.ac:		CGIEXTRAS="$CGIEXTRAS trends.cgi"
./configure.ac:	        CGIEXTRAS="$CGIEXTRAS histogram.cgi"
./configure.ac:AC_SUBST(CGIEXTRAS)
./config.status:S["CGIEXTRAS"]=" statuswrl.cgi"
./config.log:CGIEXTRAS=' statuswrl.cgi'
./Makefile.in:CGIEXTRAS=@CGIEXTRAS@
./configure:CGIEXTRAS
./configure:	CGIEXTRAS="$CGIEXTRAS statuswrl.cgi"
./configure:			CGIEXTRAS="$CGIEXTRAS statusmap.cgi"
./configure:		CGIEXTRAS="$CGIEXTRAS trends.cgi"
./configure:	        CGIEXTRAS="$CGIEXTRAS histogram.cgi"
./Makefile:CGIEXTRAS= statuswrl.cgi
./cgi/Makefile.in:CGIEXTRAS=@CGIEXTRAS@
./cgi/Makefile.in:CGIS=archivejson.cgi avail.cgi cmd.cgi config.cgi extinfo.cgi history.cgi notifications.cgi objectjson.cgi outages.cgi showlog.cgi status.cgi statusjson.cgi statuswml.cgi summary.cgi tac.cgi $(CGIEXTRAS)
./cgi/Makefile:CGIEXTRAS= statuswrl.cgi
./cgi/Makefile:CGIS=archivejson.cgi avail.cgi cmd.cgi config.cgi extinfo.cgi history.cgi notifications.cgi objectjson.cgi outages.cgi showlog.cgi status.cgi statusjson.cgi statuswml.cgi summary.cgi tac.cgi $(CGIEXTRAS)

nagios 4.4.7

setup

curl -LO https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.7.tar.gz
tar zxf nagios-4.4.7.tar.gz
cd nagioscore-nagios-4.4.7/
./configure --enable-libtap;make -s all -j5

test

make test -s
test-squeue:
### squeue tests
Test results: 390647 passed, 0 failed

test-kvvec:
### key/value vector tests
Test results: 59 passed, 0 failed

test-iocache:
### iocache_use_delim() test
  ### Testing delimiter of len 1
  ### Testing delimiter of len 2
  ### Testing delimiter of len 7
  ### Testing delimiter of len 25
Test results: 52 passed, 0 failed

test-iobroker:
### iobroker ipc test
Test results: 6003 passed, 0 failed

test-bitmap:
### bitmap tests
Test results: 57 passed, 0 failed

test-dkhash:
### dkhash basic test
Test results: 12 passed, 0 failed
### dkhash_walk_data() test
Test results: 27 passed, 0 failed
### dkhash single bucket add remove forward
Test results: 10 passed, 0 failed
### dkhash single bucket add remove backward
Test results: 9 passed, 0 failed

test-runcmd:
### exec output comparison
Test results: 16 passed, 0 failed
### anomaly detection
Test results: 36 passed, 0 failed
### argument splitting
Test results: 51 passed, 0 failed

test-nsutils:
### tv_delta tests
  PASS tv_delta_msec()
  PASS tv_delta_f() * 1000 is 2.50 and should be 2.5
  PASS mkstr() must build proper strings
  PASS 2 online cpus detected
Test results: 4 passed, 0 failed

test-fanout:
### fanout tests
Test results: 1119 passed, 0 failed

610cgistatus.t .................. ok
611cgistatus-hosturgencies.t .... ok
615cgierror.t ................... ok
616cginotification.t ............ ok
617statuswml.t .................. ok
618cgisecurity.t ................ sh: 1: /home/jsoref/nagioscore-nagios-4.4.7/t/../cgi/statusmap.cgi: not found
618cgisecurity.t ................ 1/?
#   Failed test 'Expected escaping of quotes'
#   at 618cgisecurity.t line 21.
#                   ''
#     doesn't match '(?^:' style=xss:expression(alert('XSS')) ')'
#
# Looks like you failed 1 test of 3.
618cgisecurity.t ................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
622extinfo-local.t .............. ok
623cmd-local.t .................. ok
660status-downtimes-comments.t .. ok
705nagiostats.t ................. ok
900-configparsing.t ............. 1/2
#   Failed test 'Nagios precached objects discrepancy!!!
# Test with: diff -u /home/jsoref/nagioscore-nagios-4.4.7/t/var/objects.precache.expected /home/jsoref/nagioscore-nagios-4.4.7/t/var/objects.precache.generated
# Copy with: cp /home/jsoref/nagioscore-nagios-4.4.7/t/var/objects.precache.generated /home/jsoref/nagioscore-nagios-4.4.7/t/var/objects.precache.expected'
#   at 900-configparsing.t line 34.
# Looks like you failed 1 test of 2.
900-configparsing.t ............. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
910-noservice.t ................. ok
920-nocontactgroup.t ............ ok
930-emptygroups.t ............... ok

Test Summary Report
-------------------
618cgisecurity.t              (Wstat: 256 Tests: 3 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
900-configparsing.t           (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
Files=14, Tests=475,  6 wallclock secs ( 0.11 usr  0.02 sys +  5.67 cusr  0.61 csys =  6.41 CPU)
Result: FAIL
make[2]: *** [Makefile:6: test] Error 1
make[1]: *** [Makefile:253: test-perl] Error 2
make: *** [Makefile:239: test] Error 2

This test has no conditions:
https://github.com/NagiosEnterprises/nagioscore/blob/nagios-4.4.7/t/618cgisecurity.t

And is run unconditionally
https://github.com/NagiosEnterprises/nagioscore/blob/nagios-4.4.7/t/Makefile.in#L6

But, statusmap isn't always built (I don't offhand know why it wasn't built here, possibly because I asked about --enable-libtap):
https://github.com/NagiosEnterprises/nagioscore/search?q=CGIEXTRAS

Anyway, make test should pass. Whether that means the .t shouldn't be run, or the .t should check for the .cgi and decide not to do anything, doesn't matter to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants