Hello!
When the SSH server is GNU lshd, build-remote.pl wouldn’t terminate
because the stdin of the subshell that calls ‘read’ would never be
closed:
$ ssh OPENSSH-HOST '( read ; kill -INT -$$ )<&0 & echo hey' ; echo $?
hey
0
$ ssh LSHD-HOST '( read ; kill -INT -$$ )<&0 & echo hey' ; echo $?
hey
[sits there until you hit RET]
0
(The behavior of lshd seems OK to me since the subshell gets a copy of
the parent shell’s stdin, so closing one shouldn’t close the other.)
So I’ve tried this replacement using ‘trap’, which seems to work well
for me:
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index c805d67..5250dda 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -240,7 +240,7 @@ my $buildFlags = "--max-silent-time $maxSilentTime --fallback --add-root $rootsD
# in which case every child receives SIGHUP; however, `-tt' doesn't
# work on some platforms when connection sharing is used.)
pipe STDIN, DUMMY; # make sure we have a readable STDIN
-if (system("exec ssh $hostName @sshOpts '(read; kill -INT -\$\$) <&0 & nix-store -r $drvPath $buildFlags > /dev/null' 2>&4") != 0) {
+if (system("exec ssh $hostName @sshOpts 'trap \"kill -INT -\$\$\" SIGPIPE ; nix-store -r $drvPath $buildFlags > /dev/null' 2>&4") != 0) {
# Note that if we get exit code 100 from `nix-store -r', it
# denotes a permanent build failure (as opposed to an SSH problem
# or a temporary Nix problem). We propagate this to the caller to
What do you think?
Thanks,
Ludo’.
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev