texlive[50107] Master/tlpkg/TeXLive/TLUtils.pm: (copy): die or warn

commits+karl at tug.org commits+karl at tug.org
Sun Feb 24 00:05:02 CET 2019


Revision: 50107
          http://tug.org/svn/texlive?view=revision&revision=50107
Author:   karl
Date:     2019-02-24 00:05:02 +0100 (Sun, 24 Feb 2019)
Log Message:
-----------
(copy): die or warn in more failure cases.
(unpack): remove_container -> remove_containerfile name.

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLUtils.pm

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2019-02-23 22:34:30 UTC (rev 50106)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2019-02-23 23:05:02 UTC (rev 50107)
@@ -1137,10 +1137,14 @@
     $outfile = "$destdir/$filename";
   }
 
-  mkdirhier ($destdir) unless -d "$destdir";
+  if (! -d $destdir) {
+    my ($ret,$err) = mkdirhier ($destdir);
+    die "mkdirhier($destdir) failed: $err\n" if ! $ret;
+  }
 
   if (-l "$infile") {
-    symlink (readlink $infile, "$destdir/$filename");
+    symlink (readlink $infile, "$destdir/$filename")
+    || die "symlink(readlink $infile, $destdir/$filename) failed: $!";
   } else {
     if (! open (IN, $infile)) {
       warn "open($infile) failed, not copying: $!";
@@ -1148,13 +1152,13 @@
     }
     binmode IN;
 
-    $mode = (-x "$infile") ? oct("0777") : oct("0666");
+    $mode = (-x $infile) ? oct("0777") : oct("0666");
     $mode &= ~umask;
 
     open (OUT, ">$outfile") || die "open(>$outfile) failed: $!";
     binmode OUT;
 
-    chmod $mode, "$outfile";
+    chmod ($mode, $outfile) || warn "chmod($mode,$outfile) failed: $!";
 
     while ($read = sysread (IN, $buffer, $blocksize)) {
       die "read($infile) failed: $!" unless defined $read;
@@ -1167,8 +1171,9 @@
       }
     }
     close (OUT) || warn "close($outfile) failed: $!";
-    close IN || warn "close($infile) failed: $!";;
-    @stat = lstat ("$infile");
+    close (IN) || warn "close($infile) failed: $!";;
+    @stat = lstat ($infile);
+    die "lstat($infile) failed: $!" if ! @stat;
     utime ($stat[8], $stat[9], $outfile);
   }
 }
@@ -2224,7 +2229,8 @@
     # we can remove it afterwards
     $remove_containerfile = 1;
   }
-  if (!system_pipe($decompressor, $containerfile, $tarfile, $remove_container, @decompressorArgs)
+  if (!system_pipe($decompressor, $containerfile, $tarfile,
+                   $remove_containerfile, @decompressorArgs)
       ||
       ! -f $tarfile) {
     unlink($tarfile, $containerfile);



More information about the tex-live-commits mailing list