From 95304172a581a1052a3b6bcda2ef1a8531f88949 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 21 Sep 2005 17:06:06 +0000 Subject: [PATCH] * Don't use IPC::Open2, it has a subtle race bug on Mac OS X 10.4. If the parent runs before the child, it closes some pipe file descriptors which causes the child to fail due to a bad file descriptor. So we just use the normal open() function instead. This fixes NIX-14 (intermittent nix-pull failures). --- scripts/nix-pull.in | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index e5c9cac53..eb14a1739 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -1,7 +1,6 @@ #! @perl@ -w -I@libexecdir@/nix use strict; -use IPC::Open2; use POSIX qw(tmpnam); use readmanifest; @@ -74,11 +73,9 @@ print "$size store paths in manifest\n"; # Register all substitutes. print STDERR "registering substitutes...\n"; -my $pid = open2(\*READ, \*WRITE, "$binDir/nix-store --register-substitutes") +my $pid = open(WRITE, "|$binDir/nix-store --register-substitutes") or die "cannot run nix-store"; -close READ; - foreach my $storePath (keys %narFiles) { my $narFileList = $narFiles{$storePath}; foreach my $narFile (@{$narFileList}) { @@ -95,7 +92,4 @@ foreach my $storePath (keys %narFiles) { } } -close WRITE; - -waitpid $pid, 0; -$? == 0 or die "nix-store failed"; +close WRITE or die "nix-store failed: $?";