summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-05-14 00:31:00 +0000
committerNorbert Preining <preining@logic.at>2016-05-14 00:31:00 +0000
commitaaa3d6879a54492a4e73a1c485f5fc63aa1ea049 (patch)
treebb5132a1015f63a8e04a4ea127c1eea413785e7a /Master/tlpkg/TeXLive
parentecc694f7532882098b662f8ccda8c810dc1ce53c (diff)
tempdir rework: use consistently tl_tmpdir/tmpfile for debugging
git-svn-id: svn://tug.org/texlive/trunk@41104 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLConfFile.pm1
-rw-r--r--Master/tlpkg/TeXLive/TLCrypto.pm2
-rw-r--r--Master/tlpkg/TeXLive/TLDownload.pm3
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm9
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm24
5 files changed, 25 insertions, 14 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfFile.pm b/Master/tlpkg/TeXLive/TLConfFile.pm
index 7b113b8d53d..481214f5241 100644
--- a/Master/tlpkg/TeXLive/TLConfFile.pm
+++ b/Master/tlpkg/TeXLive/TLConfFile.pm
@@ -7,7 +7,6 @@
package TeXLive::TLConfFile;
use TeXLive::TLUtils;
-use File::Temp qw/tempfile/;
my $svnrev = '$Revision$';
my $_modulerevision;
diff --git a/Master/tlpkg/TeXLive/TLCrypto.pm b/Master/tlpkg/TeXLive/TLCrypto.pm
index ed61a663d56..fdc01215c7c 100644
--- a/Master/tlpkg/TeXLive/TLCrypto.pm
+++ b/Master/tlpkg/TeXLive/TLCrypto.pm
@@ -427,7 +427,7 @@ sub gpg_verify_signature {
}
$file_quote = TeXLive::TLUtils::quotify_path_with_spaces ($file);
$sig_quote = TeXLive::TLUtils::quotify_path_with_spaces ($sig);
- my ($status_fh, $status_file) = File::Temp::tempfile(UNLINK => 1);
+ my ($status_fh, $status_file) = TeXLive::TLUtils::tl_tmpfile();
close($status_fh);
my ($out, $ret)
= TeXLive::TLUtils::run_cmd("$::gpg --status-file \"$status_file\" --verify $sig_quote $file_quote 2>&1");
diff --git a/Master/tlpkg/TeXLive/TLDownload.pm b/Master/tlpkg/TeXLive/TLDownload.pm
index d4ea57bf45d..61ea332bc92 100644
--- a/Master/tlpkg/TeXLive/TLDownload.pm
+++ b/Master/tlpkg/TeXLive/TLDownload.pm
@@ -8,7 +8,6 @@ package TeXLive::TLDownload;
use TeXLive::TLUtils;
use TeXLive::TLConfig;
-use File::Temp qw/tempfile/;
my $svnrev = '$Revision$';
my $_modulerevision;
@@ -120,7 +119,7 @@ sub get_file {
my $realout = $out;
my ($outfh, $outfn);
if ($out eq "|") {
- ($outfh, $outfn) = tempfile(UNLINK => 1);
+ ($outfh, $outfn) = tl_tmpfile();
$realout = $outfn;
}
my $response = $self->{'ua'}->get($url, ':content_file' => $realout);
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index b82d747c2bb..de483db5803 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -97,8 +97,6 @@ use TeXLive::TLUtils qw(dirname mkdirhier member win32 info log debug ddebug
tlwarn basename download_file merge_into tldie);
use TeXLive::TLWinGoo;
-use File::Temp qw/tempfile/;
-
use Cwd 'abs_path';
my $_listdir;
@@ -307,7 +305,7 @@ sub from_file {
# on windows that doesn't work, so we close the fh immediately
# this creates a short loophole, but much better than before anyway
my $tlpdbfh;
- ($tlpdbfh, $tlpdbfile) = tempfile();
+ ($tlpdbfh, $tlpdbfile) = TeXLive::TLUtils::tl_tmpfile();
# same as above
close($tlpdbfh);
my $tlpdbfile_quote = $tlpdbfile;
@@ -319,7 +317,7 @@ sub from_file {
my $xz_succeeded = 0 ;
if (defined($::progs{'xzdec'})) {
# we first try the xz compressed file
- my ($xzfh, $xzfile) = tempfile();
+ my ($xzfh, $xzfile) = TeXLive::TLUtils::tl_tmpfile();
close($xzfh);
my $xzfile_quote = $xzfile;
if (win32()) {
@@ -434,10 +432,7 @@ sub from_file {
$self->{'verified'} = $is_verified;
- # remove the xzdec-ed tlpdb file from temp dir
- # THAT IS RACY!!! we should fix that in some better way with tempfile
close($retfh);
- unlink($tlpdbfile) if $tlpdbfile;
return($found);
}
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index ab9b754fd31..4ed3c5a7636 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -34,6 +34,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure
TeXLive::TLUtils::which($string);
TeXLive::TLUtils::get_system_tmpdir();
TeXLive::TLUtils::tl_tmpdir();
+ TeXLive::TLUtils::tl_tmpfile();
TeXLive::TLUtils::xchdir($dir);
TeXLive::TLUtils::wsystem($msg,@args);
TeXLive::TLUtils::xsystem(@args);
@@ -479,9 +480,26 @@ is terminated.
=cut
sub tl_tmpdir {
- return (File::Temp::tempdir(CLEANUP => 1));
+ my $tmp = File::Temp::tempdir(CLEANUP => 1);
+ debug("tl_tempdir: creating tempdir $tmp\n");
+ return ($tmp);
}
+=item C<tl_tmpfile>
+
+Create a temporary file which is removed when the program
+is terminated. Returns file handle and file name.
+Arguments are passed on to C<File::Temp::tempfile>.
+
+=cut
+
+sub tl_tmpfile {
+ my ($fh, $fn) = File::Temp::tempfile(@_, UNLINK => 1);
+ debug("tl_tempfile: creating tempfile $fn\n");
+ return ($fh, $fn);
+}
+
+
=item C<xchdir($dir)>
C<chdir($dir)> or die.
@@ -2628,7 +2646,7 @@ sub check_for_old_updmap_cfg {
my $nn = "$oldupd.DISABLED";
if (-r $nn) {
my $fh;
- ($fh, $nn) = File::Temp::tempfile(
+ ($fh, $nn) = tl_tmpfile(
"updmap.cfg.DISABLED.XXXXXX", DIR => "$tmfsysconf/web2c");
}
print "Renaming old config file from
@@ -3616,7 +3634,7 @@ sub download_to_temp_or_file {
my $url = shift;
my ($url_fh, $url_file);
if ($url =~ m,^(http|ftp|file)://,) {
- ($url_fh, $url_file) = File::Temp::tempfile(UNLINK => 1);
+ ($url_fh, $url_file) = tl_tmpfile();
# now $url_fh filehandle is open, the file created
# TLUtils::download_file will just overwrite what is there
# on windows that doesn't work, so we close the fh immediately