diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-01-19 16:58:39 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-01-19 17:16:14 +0100 |
commit | 21948deed99a3295e4d5666e027a6ca42dc00b40 (patch) | |
tree | 62579dc51fdee152a67486d428f39ecceb84f08e /tests | |
parent | 63e10b4d28e64107e51207f292ab0093a95c1bc6 (diff) |
Kill builds when we get EOF on the log FD
This closes a long-time bug that allowed builds to hang Nix
indefinitely (regardless of timeouts) simply by doing
exec > /dev/null 2>&1; while true; do true; done
Now, on EOF, we just send SIGKILL to the child to make sure it's
really gone.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/timeout.nix | 8 | ||||
-rw-r--r-- | tests/timeout.sh | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/timeout.nix b/tests/timeout.nix index 1f3f23f16..540fba934 100644 --- a/tests/timeout.nix +++ b/tests/timeout.nix @@ -17,4 +17,12 @@ with import ./config.nix; ''; }; + closeLog = mkDerivation { + name = "silent"; + buildCommand = '' + exec > /dev/null 2>&1 + sleep 1000000000 + ''; + }; + } diff --git a/tests/timeout.sh b/tests/timeout.sh index ba9a6c3df..ce1ae7d67 100644 --- a/tests/timeout.sh +++ b/tests/timeout.sh @@ -24,3 +24,8 @@ if nix-build timeout.nix -A silent --max-silent-time 2; then echo "build should have failed" exit 1 fi + +if nix-build timeout.nix -A closeLog; then + echo "build should have failed" + exit 1 +fi |