From 3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Fri, 11 Jan 2019 11:19:59 +0100 Subject: [PATCH] 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. --- pkgs/servers/http/lighttpd/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/servers/http/lighttpd/default.nix b/pkgs/servers/http/lighttpd/default.nix index a7e9c1447f1..db459dc81c8 100644 --- a/pkgs/servers/http/lighttpd/default.nix +++ b/pkgs/servers/http/lighttpd/default.nix @@ -24,6 +24,8 @@ stdenv.mkDerivation rec { postPatch = '' patchShebangs tests + # Linux sandbox has an empty hostname and not /etc/hosts, which fails some tests + sed -ire '/[$]self->{HOSTNAME} *=/i if(length($name)==0) { $name = "127.0.0.1" }' tests/LightyTest.pm ''; nativeBuildInputs = [ pkgconfig ];