From 0c8e0812140de740c21f66df8827010d1323311c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 23 Feb 2019 23:05:02 +0000 Subject: (copy): die or warn in more failure cases. (unpack): remove_container -> remove_containerfile name. git-svn-id: svn://tug.org/texlive/trunk@50107 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLUtils.pm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index cce5af67328..01fab4c90f0 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1137,10 +1137,14 @@ sub copy { $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 @@ sub copy { } 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 @@ sub copy { } } 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 @@ sub unpack { # 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); -- cgit v1.2.3