darkhttpd icon indicating copy to clipboard operation
darkhttpd copied to clipboard

tests: failed in ubuntu18.04 arm64/amd64

Open wiselike opened this issue 7 months ago • 3 comments

here is the output:

root@1b773598eefc:~/darkhttpd# make test
make -C devel
make[1]: Entering directory '/root/darkhttpd/devel'
./run-tests
===> test_make_safe_uri
===> test_password_equal
===> building without -DDEBUG
===> building with -DNO_IPV6
===> building a.out and darkhttpd.gcno for coverage + asan + ubsan
===> run usage statement
===> run test for binding to bogus address (IPv4)
===> run test for binding to bogus address (IPv6)
===> run test for binding to IPv4 when IPv6 requested
===> run tests against a basic instance (generates darkhttpd.gcda)
..................FFFFFF....................................FFFFFF....................................................................
======================================================================
FAIL: test_forbidden_HTTP0_9_CRLF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'HTTP/1.1 404 Not Found\r\nDate: Mon, 26 May 2025 12:21:11 GMT\r\nServer: darkhttpd/1.16.from.git\r\nAccept-Ranges: bytes\r\nConnection: close\r\nContent-Length: 215\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n<!DOCTYPE html><html><head><title>404 Not Found</title></head><body>\n<h1>Not Found</h1>\nThe URL you requested was not found.\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body></html>\n'

======================================================================
FAIL: test_forbidden_HTTP0_9_LF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'HTTP/1.1 404 Not Found\r\nDate: Mon, 26 May 2025 12:21:11 GMT\r\nServer: darkhttpd/1.16.from.git\r\nAccept-Ranges: bytes\r\nConnection: close\r\nContent-Length: 215\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n<!DOCTYPE html><html><head><title>404 Not Found</title></head><body>\n<h1>Not Found</h1>\nThe URL you requested was not found.\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body></html>\n'

======================================================================
FAIL: test_forbidden_HTTP1_0_CRLF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html><html><head><title>404 Not Found</title></head><body>\n<h1>Not Found</h1>\nThe URL you requested was not found.\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body></html>\n'

======================================================================
FAIL: test_forbidden_HTTP1_0_LF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html><html><head><title>404 Not Found</title></head><body>\n<h1>Not Found</h1>\nThe URL you requested was not found.\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body></html>\n'

======================================================================
FAIL: test_forbidden_HTTP1_1_CRLF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html><html><head><title>404 Not Found</title></head><body>\n<h1>Not Found</h1>\nThe URL you requested was not found.\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body></html>\n'

======================================================================
FAIL: test_forbidden_HTTP1_1_LF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html><html><head><title>404 Not Found</title></head><body>\n<h1>Not Found</h1>\nThe URL you requested was not found.\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body></html>\n'

======================================================================
FAIL: test_unreadable_HTTP0_9_CRLF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'HTTP/1.1 200 OK\r\nDate: Mon, 26 May 2025 12:21:11 GMT\r\nServer: darkhttpd/1.16.from.git\r\nAccept-Ranges: bytes\r\nConnection: close\r\nContent-Length: 290\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n<!DOCTYPE html>\n<html>\n<head>\n<title>/unreadable/</title>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n</head>\n<body>\n<h1>/unreadable/</h1>\n<pre>\n<a href="../">..</a>/\n</pre>\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body>\n</html>\n'

======================================================================
FAIL: test_unreadable_HTTP0_9_LF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'HTTP/1.1 200 OK\r\nDate: Mon, 26 May 2025 12:21:11 GMT\r\nServer: darkhttpd/1.16.from.git\r\nAccept-Ranges: bytes\r\nConnection: close\r\nContent-Length: 290\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n<!DOCTYPE html>\n<html>\n<head>\n<title>/unreadable/</title>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n</head>\n<body>\n<h1>/unreadable/</h1>\n<pre>\n<a href="../">..</a>/\n</pre>\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body>\n</html>\n'

======================================================================
FAIL: test_unreadable_HTTP1_0_CRLF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html>\n<html>\n<head>\n<title>/unreadable/</title>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n</head>\n<body>\n<h1>/unreadable/</h1>\n<pre>\n<a href="../">..</a>/\n</pre>\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body>\n</html>\n'

======================================================================
FAIL: test_unreadable_HTTP1_0_LF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html>\n<html>\n<head>\n<title>/unreadable/</title>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n</head>\n<body>\n<h1>/unreadable/</h1>\n<pre>\n<a href="../">..</a>/\n</pre>\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body>\n</html>\n'

======================================================================
FAIL: test_unreadable_HTTP1_1_CRLF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html>\n<html>\n<head>\n<title>/unreadable/</title>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n</head>\n<body>\n<h1>/unreadable/</h1>\n<pre>\n<a href="../">..</a>/\n</pre>\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body>\n</html>\n'

======================================================================
FAIL: test_unreadable_HTTP1_1_LF (__main__.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 210, in do_test
    body_checker(self, body)
  File "test.py", line 239, in <lambda>
    lambda self,body: getattr(self, assert_name)(body, url))
  File "test.py", line 146, in assertForbidden
    'Generated by darkhttpd')
  File "test.py", line 120, in assertContains
    repr(s), repr(body)))
AssertionError: False is not true :
Expected: '<title>403 Forbidden</title>'
In response: b'<!DOCTYPE html>\n<html>\n<head>\n<title>/unreadable/</title>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n</head>\n<body>\n<h1>/unreadable/</h1>\n<pre>\n<a href="../">..</a>/\n</pre>\n<hr>\nGenerated by darkhttpd/1.16.from.git on Mon, 26 May 2025 12:21:11 GMT\n</body>\n</html>\n'

----------------------------------------------------------------------
Ran 134 tests in 0.273s

FAILED (failures=12)
FAILED! stderr was:
---
---
Makefile:2: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/root/darkhttpd/devel'
Makefile:11: recipe for target 'test' failed
make: *** [test] Error 2

here is the system infomation:

root@1b773598eefc:~/darkhttpd# uname -a
Linux 1b773598eefc 4.19.157-perf+ #1 SMP PREEMPT Tue Apr 23 02:56:51 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
root@1b773598eefc:~/darkhttpd# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
root@1b773598eefc:~/darkhttpd# python -V
Python 2.7.17
root@1b773598eefc:~/darkhttpd# gcc --version
gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@1b773598eefc:~/darkhttpd# python3 -V
Python 3.6.9


wiselike avatar May 26 '25 12:05 wiselike

When I run it as root I also get these errors. As normal user it passes. Idk why, but I think it's not an unreasonable requirement.

g-rden avatar May 26 '25 13:05 g-rden

run-tests does chmod 0 $DIR/forbidden to make the file inaccessible, but root can still access it.

I would really prefer to say "running tests as root is not supported" potentially with an explicit if uid = 0 then error out because it's good hygiene to not do builds or run tests as root.

emikulic avatar May 27 '25 07:05 emikulic

run-tests does chmod 0 $DIR/forbidden to make the file inaccessible, but root can still access it.

I would really prefer to say "running tests as root is not supported" potentially with an explicit if uid = 0 then error out because it's good hygiene to not do builds or run tests as root.

With the popularity of Docker, the root user is more commonly used both for building and testing. I think you can run this one test on the nobody user to let $DIR/forbidden inaccessible.

wiselike avatar May 27 '25 07:05 wiselike