[Nix-dev] [PATCH] Make `build-remote.pl' work with GNU lshd

Eelco Dolstra e.dolstra at tudelft.nl
Fri Dec 9 11:37:39 CET 2011


On 09/12/11 11:21, Ludovic Courtès wrote:

> (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.)

I don't think so.  It's not about closing but getting an EOF.  I would expect
lshd to close the write side of the shell's stdin, so that any child process
that attempts to read from it gets EOF.

> -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) {

Does this actually work?  A process only gets a SIGPIPE if it does a write(),
right?  So if "nix-store -r" doesn't do any writes, it won't get a SIGPIPE, so
it will continue indefinitely even if the connection is down.  But if it does
write, it will get a write() error and exit.  (Nix ignores SIGPIPE, by the way).

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/


More information about the nix-dev mailing list