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

Lluís Batlle i Rossell viric at viric.name
Fri Dec 9 11:40:51 CET 2011


On Fri, Dec 09, 2011 at 11:37:39AM +0100, Eelco Dolstra wrote:
> On 09/12/11 11:21, Ludovic Courtès wrote:
> > -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).

I imagine it does not matter, but I think only a *second write* in a other-side-closed fd
ends up in sigpipe.  The first returns -1.


More information about the nix-dev mailing list