summaryrefslogtreecommitdiff
path: root/Master/tlpkg/dev/dev.tempfile-for-tlpdb.patch
blob: 82008f3f3e95f57b26a81e66d87bc1b7cd057a37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Index: TeXLive/TLPDB.pm
===================================================================
--- TeXLive/TLPDB.pm	(revision 10575)
+++ TeXLive/TLPDB.pm	(working copy)
@@ -60,6 +60,9 @@
 use TeXLive::TLUtils qw(dirname mkdirhier member win32 info debug ddebug tlwarn);
 use TeXLive::TLPOBJ;
 
+use File::Temp qw/tempfile/;
+
+
 my $_listdir;
 
 =pod
@@ -211,13 +214,20 @@
     # if we have lzmadec available we try the lzma file
     if (defined($::progs{'lzmadec'})) {
       # we first try the lzma compressed file
-      my $tmpdir = TeXLive::TLUtils::get_system_tmpdir();
-      my $bn = TeXLive::TLUtils::basename("$path");
-      my $lzmafile = "$tmpdir/$bn.lzma";
+      #
+      # we have to create a temp file to download to
+      my ($lzmafh, $lzmafile) = tempfile();
+      # now $lzmafh 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
+      # is this secure???
+      close($lzmafh);
       my $lzmafile_quote = $lzmafile;
       # 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();
+      close($tlpdbfh);
       my $tlpdbfile_quote = $tlpdbfile;
       if (win32()) {
         $lzmafile  =~ s!/!\\!g;