diff options
author | Norbert Preining <preining@logic.at> | 2008-09-12 20:36:25 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-09-12 20:36:25 +0000 |
commit | aa77a296f9898ad9dbdc806f6ad5ad318bd661d4 (patch) | |
tree | 52eb13e5b8ef005ce90392a09593fda55487fd38 | |
parent | 875b88c33a220d13aa48b66bd198467dfdf91887 (diff) |
fix removal of texlive.tlpdb in tmp dir
git-svn-id: svn://tug.org/texlive/trunk@10575 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 11 |
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); } |