summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nixos/tests/tinydns.nix16
-rw-r--r--pkgs/tools/networking/djbdns/default.nix15
-rw-r--r--pkgs/tools/networking/djbdns/softlimit.patch12
3 files changed, 40 insertions, 3 deletions
diff --git a/nixos/tests/tinydns.nix b/nixos/tests/tinydns.nix
index b80e3451700a..124508bc004b 100644
--- a/nixos/tests/tinydns.nix
+++ b/nixos/tests/tinydns.nix
@@ -21,6 +21,20 @@ import ./make-test-python.nix ({ lib, ...} : {
testScript = ''
nameserver.start()
nameserver.wait_for_unit("tinydns.service")
- nameserver.succeed("host bla.foo.bar 192.168.1.1 | grep '1\.2\.3\.4'")
+
+ # We query tinydns a few times to trigger the bug:
+ #
+ # nameserver # [ 6.105872] mmap: tinydns (842): VmData 331776 exceed data ulimit 300000. Update limits or use boot option ignore_rlimit_data.
+ #
+ # which was reported in https://github.com/NixOS/nixpkgs/issues/119066.
+ # Without the patch <nixpkgs/pkgs/tools/networking/djbdns/softlimit.patch>
+ # it fails on the 10th iteration.
+ nameserver.succeed(
+ """
+ for i in {1..100}; do
+ host bla.foo.bar 192.168.1.1 | grep '1\.2\.3\.4'
+ done
+ """
+ )
'';
})
diff --git a/pkgs/tools/networking/djbdns/default.nix b/pkgs/tools/networking/djbdns/default.nix
index 1b93d64d08f5..52f7e9a0fb55 100644
--- a/pkgs/tools/networking/djbdns/default.nix
+++ b/pkgs/tools/networking/djbdns/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, glibc, dns-root-data } :
+{ lib, stdenv, fetchurl, glibc, dns-root-data, nixosTests } :
let
version = "1.05";
@@ -19,7 +19,14 @@ stdenv.mkDerivation {
sha256 = "0j3baf92vkczr5fxww7rp1b7gmczxmmgrqc8w2dy7kgk09m85k9w";
};
- patches = [ ./hier.patch ./fix-nix-usernamespace-build.patch ];
+ patches = [
+ ./hier.patch
+ ./fix-nix-usernamespace-build.patch
+
+ # To fix https://github.com/NixOS/nixpkgs/issues/119066.
+ # Note that the NixOS test <nixpkgs/nixos/tests/tinydns.nix> tests for this.
+ ./softlimit.patch
+ ];
postPatch = ''
echo gcc -O2 -include ${glibc.dev}/include/errno.h > conf-cc
@@ -41,6 +48,10 @@ stdenv.mkDerivation {
rm -rv djbdns-man;
'';
+ passthru.tests = {
+ tinydns = nixosTests.tinydns;
+ };
+
meta = with lib; {
description = "A collection of Domain Name System tools";
longDescription = "Includes software for all the fundamental DNS operations: DNS cache: finding addresses of Internet hosts; DNS server: publishing addresses of Internet hosts; and DNS client: talking to a DNS cache.";
diff --git a/pkgs/tools/networking/djbdns/softlimit.patch b/pkgs/tools/networking/djbdns/softlimit.patch
new file mode 100644
index 000000000000..68598703ef43
--- /dev/null
+++ b/pkgs/tools/networking/djbdns/softlimit.patch
@@ -0,0 +1,12 @@
+diff -Naur a/tinydns-conf.c b/tinydns-conf.c
+--- a/tinydns-conf.c 2001-02-11 21:11:45.000000000 +0000
++++ b/tinydns-conf.c 2021-11-08 17:23:06.181385437 +0000
+@@ -46,7 +46,7 @@
+
+ start("run");
+ outs("#!/bin/sh\nexec 2>&1\nexec envuidgid "); outs(user);
+- outs(" envdir ./env softlimit -d300000 ");
++ outs(" envdir ./env softlimit -d4500000 ");
+ outs(auto_home); outs("/bin/tinydns\n");
+ finish();
+ perm(0755);