about summary refs log tree commit diff
path: root/pkgs/servers/http
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2019-01-11 11:19:59 +0100
committerMichael Raskin <7c6f434c@mail.ru>2019-01-11 11:46:23 +0100
commit3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74 (patch)
tree534bb5e000b57f66daeb9335533e3db5c2b6bc03 /pkgs/servers/http
parent5ef8b40d4dd134a285b17125db89f1e0af4e55cb (diff)
downloadnixlib-3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74.tar
nixlib-3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74.tar.gz
nixlib-3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74.tar.bz2
nixlib-3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74.tar.lz
nixlib-3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74.tar.xz
nixlib-3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74.tar.zst
nixlib-3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74.zip
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.
Diffstat (limited to 'pkgs/servers/http')
-rw-r--r--pkgs/servers/http/lighttpd/default.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkgs/servers/http/lighttpd/default.nix b/pkgs/servers/http/lighttpd/default.nix
index a7e9c1447f1c..db459dc81c8e 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 ];