Skip to content

Commit 3bd38b0

Browse files
committed
lighttpd: fix tests on Linux
The tests were enabled in #53488 and succeeded on Darwin; on Linux they still failed because of empty hostname inside the sandbox (we have no UTS-namespace hostname and I think no /etc/hosts). Nix on Darwin lacks powerful enough sandboxing, so there were no problems on Darwin. Patching the tests to fallback to "127.0.0.1" if hostname of the localhost cannot be retrieved matches the behaviour of lighttpd itself and allows the tests to pass. Not sure if having no hostname in the test environment is a bit too weird for the upstream to care.
1 parent 5ef8b40 commit 3bd38b0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkgs/servers/http/lighttpd/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
2424

2525
postPatch = ''
2626
patchShebangs tests
27+
# Linux sandbox has an empty hostname and not /etc/hosts, which fails some tests
28+
sed -ire '/[$]self->{HOSTNAME} *=/i if(length($name)==0) { $name = "127.0.0.1" }' tests/LightyTest.pm
2729
'';
2830

2931
nativeBuildInputs = [ pkgconfig ];

0 commit comments

Comments
 (0)