From d0527aac1b6e130144890ad516a9624edc0af83d Mon Sep 17 00:00:00 2001 From: regnat Date: Fri, 5 Nov 2021 11:11:33 +0100 Subject: [PATCH 1/2] Make the post-build-hook use the daemon Nix package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having the `post-build-hook` use `nix` from the client package can lead to a deadlock in case there’s a db migration to do between both, as a `nix` command running inside the hook will run as root (and as such will bypass the daemon), so might trigger a db migration, which will get stuck trying to get a global lock on the DB (as the daemon that ran the hook already has a lock on it). (cherry picked from commit 93eadd5803caa6d28be056c58194be974a87aeb8) --- tests/common.sh.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/common.sh.in b/tests/common.sh.in index 08f5e0a77..3d0d56120 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -36,8 +36,9 @@ export PATH=@bindir@:$PATH if [[ -n "${NIX_CLIENT_PACKAGE:-}" ]]; then export PATH="$NIX_CLIENT_PACKAGE/bin":$PATH fi +DAEMON_PATH="$PATH" if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then - export NIX_DAEMON_COMMAND="$NIX_DAEMON_PACKAGE/bin/nix-daemon" + DAEMON_PATH="${NIX_DAEMON_PACKAGE}:$DAEMON_PATH" fi coreutils=@coreutils@ @@ -89,7 +90,7 @@ startDaemon() { # Start the daemon, wait for the socket to appear. !!! # ‘nix-daemon’ should have an option to fork into the background. rm -f $NIX_DAEMON_SOCKET_PATH - ${NIX_DAEMON_COMMAND:-nix daemon} & + PATH=$DAEMON_PATH nix daemon & for ((i = 0; i < 30; i++)); do if [[ -S $NIX_DAEMON_SOCKET_PATH ]]; then break; fi sleep 1 From 9c15e151deb09ba8b3f3a0a8d4fa54fe973c4333 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 18 Nov 2021 22:22:33 +0000 Subject: [PATCH 2/2] Fix testing the other daemon The eventual PATH entry needs the `.../bin` or we will not use the right daemon. (cherry picked from commit 06fb6aecea43218e66ccc879471ffebb7dbfee78) --- tests/common.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common.sh.in b/tests/common.sh.in index 3d0d56120..61abab1d7 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -38,7 +38,7 @@ if [[ -n "${NIX_CLIENT_PACKAGE:-}" ]]; then fi DAEMON_PATH="$PATH" if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then - DAEMON_PATH="${NIX_DAEMON_PACKAGE}:$DAEMON_PATH" + DAEMON_PATH="${NIX_DAEMON_PACKAGE}/bin:$DAEMON_PATH" fi coreutils=@coreutils@