1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

* The write() system call can write less than the requested

number of bytes, e.g., in case of a signal like SIGSTOP.  
  This caused `nix --dump' to fail sometimes.

  Note that this bug went unnoticed because the call to `nix 
  --dump' is in a pipeline, and the shell ignores non-zero 
  exit codes from all but the last element in the pipeline.  
  Is there any way to check the result of the initial elements
  in the pipeline?  (In other words, is it at all possible to 
  write reliable shell scripts?)
This commit is contained in:
Eelco Dolstra 2003-07-16 21:24:02 +00:00
parent 335aa1c35d
commit 54664b6fb7
3 changed files with 13 additions and 3 deletions

View file

@ -8,6 +8,8 @@ foreach my $id (@ARGV) {
# Get all paths referenced by the normalisation of the given
# fstate expression.
system "nix -ih $id";
if ($?) { die "`nix -ih' failed"; }
my @paths;
open PATHS, "nix -qrh $id 2> /dev/null |" or die "nix -qrh";
while (<PATHS>) {
@ -51,6 +53,8 @@ foreach my $id (@ARGV) {
die unless $nid =~ /^([0-9a-z]{32})$/;
# Realise the Nix expression.
system "nix -ih $nid";
if ($?) { die "`nix -ih' failed"; }
my $npath = `nix -qph $nid 2> /dev/null`;
$? and die "creating Nix archive";
chomp $npath;