[ARVADOS] created: b25916b93d720f80b5bdf16f018d83c13c6c3001

git at public.curoverse.com git at public.curoverse.com
Fri May 29 13:33:38 EDT 2015


        at  b25916b93d720f80b5bdf16f018d83c13c6c3001 (commit)


commit b25916b93d720f80b5bdf16f018d83c13c6c3001
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri May 29 13:32:40 2015 -0400

    6146: Ignore SIGPIPE while feeding data to tar. Rely on close() retval instead.

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index 0fbdb82..864e3c0 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -2083,19 +2083,23 @@ if (readlink ("$destdir.archive_hash") eq $archive_hash && -d $destdir) {
 unlink "$destdir.archive_hash";
 mkdir $destdir;
 
-warn "Extracting archive: $archive_hash\n";
-if (!open(TARX, "|-", "tar", "-xC", $destdir)) {
-  die "Error launching 'tar -xC $destdir': $!";
-}
-# If we send too much data to tar in one write (> 4-5 MiB), it stops, and we
-# get SIGPIPE.  We must feed it data incrementally.
-my $tar_input;
-while (read(DATA, $tar_input, 65536)) {
-  print TARX $tar_input;
-}
-if(!close(TARX)) {
-  die "'tar -xC $destdir' exited $?: $!";
-}
+do {
+  # Ignore SIGPIPE: we check retval of close() instead. See perlipc(1).
+  local $SIG{PIPE} = "IGNORE";
+  warn "Extracting archive: $archive_hash\n";
+  if (!open(TARX, "|-", "tar", "-xC", $destdir)) {
+    die "Error launching 'tar -xC $destdir': $!";
+  }
+  # If we send too much data to tar in one write (> 4-5 MiB), it stops, and we
+  # get SIGPIPE.  We must feed it data incrementally.
+  my $tar_input;
+  while (read(DATA, $tar_input, 65536)) {
+    print TARX $tar_input;
+  }
+  if(!close(TARX)) {
+    die "'tar -xC $destdir' exited $?: $!";
+  }
+};
 
 mkdir $install_dir;
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list