summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-05-14 00:50:38 +0000
committerNorbert Preining <preining@logic.at>2011-05-14 00:50:38 +0000
commit63da657e4d3798f445ab309876e6eff60cee1110 (patch)
tree69b027f5b74ebb586258926a6b6ee6a32f138787 /Master/tlpkg
parent5d8ea2ea17d788005fa1f8b773320fa6ea725fc5 (diff)
include tempdir usage for TLPDB
git-svn-id: svn://tug.org/texlive/trunk@22469 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 76e49a965f0..9b217132406 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -86,6 +86,8 @@ use TeXLive::TLUtils qw(dirname mkdirhier member win32 info log debug ddebug
tlwarn basename download_file merge_into);
use TeXLive::TLPOBJ;
+use File::Temp qw/tempfile/;
+
use Cwd 'abs_path';
my $_listdir;
@@ -266,13 +268,21 @@ sub from_file {
# if we have xzdec available we try the xz file
if (defined($::progs{'xzdec'})) {
# we first try the xz compressed file
- my $tmpdir = TeXLive::TLUtils::get_system_tmpdir();
- my $bn = TeXLive::TLUtils::basename("$path");
- my $xzfile = "$tmpdir/$bn.$$.xz";
+ #
+ # we have to create a temp file to download to
+ my ($xzfh, $xzfile) = tempfile();
+ # now $xzfh 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
+ # this creates a short loophole, but much better than before anyway
+ close($lzmafh);
my $xzfile_quote = $xzfile;
# this is a variable of the whole sub as we have to remove the file
# before returning
- $tlpdbfile = "$tmpdir/$bn.$$";
+ my $tlpdbfh;
+ ($tlpdbfh, $tlpdbfile) = tempfile();
+ # same as above
+ close($tlpdbfh);
my $tlpdbfile_quote = $tlpdbfile;
if (win32()) {
$xzfile =~ s!/!\\!g;