[tex-live] tlmgr leaves texlive.tlpdb.SOMETHING
Reinhard Kotucha
reinhard.kotucha at web.de
Thu Jul 3 00:26:00 CEST 2014
On 2014-07-02 at 20:26:13 +0900, Norbert Preining wrote:
> On Wed, 02 Jul 2014, Reinhard Kotucha wrote:
>> However, whenever I run 'tlmgr update' a temporary file is
>> created in $TMPDIR. It's not removed if it's not needed anymore.
>> It's no problem either but IMO it's good practice to remove
>> temporary files if they aren't needed anymore.
>>
>> For getnonfreefonts I wrote a signal handler which supports
>> signals supported by Unix and Windows. I derived the Windows
>> stuff from the sources of the Windows C runtime library
>> (MSVCRT.DLL).
>
> Please send me the code and I will see how to include it.
-------------------------------------------------------
# Create a list of signals
sub signals {
my @signals;
my @common_signals=qw(INT ILL FPE SEGV TERM ABRT);
my @signals_Unix=qw(QUIT BUS PIPE);
my @signals_W32=qw(BREAK);
if (win32) {
@signals=(@common_signals, @signals_W32);
} else {
@signals=(@common_signals, @signals_Unix);
}
return @signals;
}
# The actual signal handler.
sub remove_tmp_files {
# put your unlink/rmdir code here
}
# install signal handlers
foreach my $signal (signals()) {
$SIG{"$signal"}=\&remove_tmp_files;
}
# Delete temporary files when the program exits normally.
# You can do this either when the files are not needed
# anymore or when the script exits. The code below behaves
# like atexit() in C.
END {
remove_tmp_files();
}
-------------------------------------------------------
I recommend to put the definition of signals() into TLUtils.pm so that
it can be used by other scripts too. When you port fmtutil to Perl, I
suppose that you want to create format files within a temporary
directory and overwrite the existing files only if the new ones are
created successfully. AFAIK this is what fmtutil and mktexlsr do ATM.
BTW, I recommend to prefix temporary files with the name of the
program which created them. For instance "tlmgr-J22DbpskXl" instead
of "J22DbpskXl". If many temporary files are created (by fmtutil, for
example) it's better to create a directory "$TMPDIR/<progname>/".
This recommendation is not tlmgr- or TeX Live- specific, it would be
nice if *all* programs follow this convention.
Then such files can be removed conveniently:
$ rm $TMPDIR/tlmgr-*
$ rm -rf $TMPDIR/fmtutil
It's best, of course, if programs delete their temporary files
themselves when they are not needed anymore.
Regards,
Reinhard
--
------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at web.de
------------------------------------------------------------------
More information about the tex-live
mailing list