Upgrade failure and corrupted installation ?

Jonathan Fine jfine2358 at gmail.com
Mon Aug 28 18:40:25 CEST 2023


Norbert wrote:

It happens very rarely, we already try to ensure that writes are done on a
> per package basis, and fs are synced afterwards. Having a completely safe
> against interrupts implementation would be nice, but would require
> developing
> some journaling for tlmgr operations, which we don't have.
>

This statement is helpful. I have one additional comment. It may be that
adding sufficient "journaling for tlmgr operations" would be practical, and
in particular not too hard.

The tlmgr is written in Perl. If Python were used, a 'with statement
context manager' would in my opinion solve most or all the problems of file
writes failing and so needing a cleanup. I wonder, is there something
similar in Perl?

There's documentation of the Python "with" statement at:
https://peps.python.org/pep-0343/
https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers

The basic idea is that
    with manager(parameters) as mgr:
        do_something_using(mgr)
means

1. obj = manager(parameter) has __enter__ and __exit__ methods.
2. mgr is given the value of obj.__enter__().
3. Upon exiting the with statement, either normally or with an exception,
obj.__exit(...) is called.
4. The obj.__exit__(...) has as parameter either None or the exception (if
there is one).
5. After obj.__exit__(...) is done, the "with" statement will reraise the
exception (if there is one).

The obj.__exit(...) method should at the very least close file handles,
release other resources. For tlmgr, we'd like it to do any cleanup required
to produce a consistent state on disk. If I'm correct, this will be
sufficient for solving (or at least substantially improving) the present
situation with tlmgr. In my opinion, this would provide sufficient
"journaling for tlmgr operations".

I think it would be most helpful if Perl has something similar to the
Python "with" statement. Hence my asking if Perl has such.

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


More information about the tex-live mailing list.