about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-09-21T17·06+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-09-21T17·06+0000
commit95304172a581a1052a3b6bcda2ef1a8531f88949 (patch)
treef17fdbb5bca7c465f4788a6cc54e27a9272c9a14
parenta864aca44cf2eb0b6b39f5e06ac4112250a05358 (diff)
* 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).

-rw-r--r--scripts/nix-pull.in10
1 files changed, 2 insertions, 8 deletions
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index e5c9cac53666..eb14a1739549 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: $?";