Upgrade failure and corrupted installation ?

Jonathan Fine jfine2358 at gmail.com
Tue Aug 29 20:05:27 CEST 2023


Hi

We're talking about cleanup code, for when tlmgr has an 'irregular' exit
due, for example, from an OS error or a keyboard interrupt.

I agree with Zdeněk's statement, that in Perl obj->DESTROY is called when
the last reference to the object disappears. I referenced a reddit link
which says, if I understand matters properly, that this can at least
sometimes be used to achieve an effect similar to that provided by Python's
"with" statement. I've also found a perlmonks thread that expresses the
same idea. Here are both the URLs:
https://www.reddit.com/r/perl/comments/e4x90y/context_manager_in_perl/
https://www.perlmonks.org/?node_id=11120738

Zdeněk and I seem to agree that this feature can be used to call
obj->DESTROY so that cleanup code can run during an 'irregular' exit,
provided this exit is not caused by the interrupt key (Control-C).

In Python, a Control-C exit can be caught and processed. I've tested this
on my PC, and here's a reference to the docs:
https://docs.python.org/3/library/exceptions.html

I'm not sure about Zdeněk's statement about Control-C in Perl. I've read:
https://www.perl.com/article/37/2013/8/18/Catch-and-Handle-Signals-in-Perl/

Under the heading "Useful signal handling behaviour" that page says:

> It’s common to call die when handling SIGINT and SIGTERM. die is useful
because it will ensure that Perl stops correctly: for example Perl will
execute a destructor method if present when die is called, but the
destructor method will not be called if a SIGINT or SIGTERM is received and
no signal handler calls die. Additional behaviors that are useful in a
signal handling subroutine are stack tracing, event logging, thread
termination and temporary file clean up. The correct behavior to define
will depend on the type of signal received and the type of Perl program.

It seems to me that if tlmgr is not already doing cleanup (and so leaving
the system in a consistent state) for irregular exits, then it is worth
investigating the addition of obj->DESTROY methods and signal handlers to
improve behaviour under irregular exits. This is an opinion based on
analogy with other systems, rather than special knowledge of Perl and tlmgr.

-- 
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20230829/6ffdaf28/attachment.htm>


More information about the tex-live mailing list.