summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 32c29e10713..55faf348cf1 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -205,6 +205,7 @@ sub from_file {
$self->root($root_from_path);
}
my $retfh;
+ my $tlpdbfile;
if ($path =~ m;^((http|ftp)://|file:\/\/*);) {
debug("TLPDB.pm: trying to initialize from $path\n");
# if we have lzmadec available we try the lzma file
@@ -214,7 +215,9 @@ sub from_file {
my $bn = TeXLive::TLUtils::basename("$path");
my $lzmafile = "$tmpdir/$bn.lzma";
my $lzmafile_quote = $lzmafile;
- my $tlpdbfile = "$tmpdir/$bn";
+ # this is a variable of the whole sub as we have to remove the file
+ # before returning
+ $tlpdbfile = "$tmpdir/$bn";
my $tlpdbfile_quote = $tlpdbfile;
if (win32()) {
$lzmafile =~ s!/!\\!g;
@@ -231,6 +234,9 @@ sub from_file {
# lzmadec *hopefully* returns 0 on success and anything else on failure
if (!system("$::progs{'lzmadec'} < $lzmafile_quote > $tlpdbfile_quote")) {
debug("Un-lzmaing $lzmafile did not succeed, try normally\n");
+ # to be sure we unlink the lzma file and the tlpdbfile
+ unlink($lzmafile);
+ unlink($tlpdbfile);
} else {
unlink($lzmafile);
open $retfh, "<$tlpdbfile" or die"Cannot open $tlpdbfile!";
@@ -266,6 +272,9 @@ sub from_file {
if (!$found) {
tlwarn("Cannot read any package from $path, seems not to be a TLPDB!");
}
+ # remove the un-lzma-ed tlpdb file from temp dir
+ # THAT IS RACY!!! we should fix that in some better way with tempfile
+ unlink($tlpdbfile) if $tlpdbfile;
return($found);
}