[issue19081] zipimport behaves badly when the zip file changes while the process is running

Gregory P. Smith report at bugs.python.org
Mon Sep 14 12:53:59 EDT 2020


Gregory P. Smith <greg at krypto.org> added the comment:

On POSIX systems, keeping the file open means you will keep a handle to the original file in the case where something moves a new file into it's place (as is normal during software package updates) or otherwise unlinks the original.  That is the situation that led to filing this issue and is one that is technically solvable by keeping the file handle open and always using that for access.

We can't do anything very meaningful about someone opening the existing file in 'w+a' mode and scribbling other bytes over it.  I wouldn't try to protect against that.  "locking" a file isn't an option on most platforms and when available, is very unusual to do in this century.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue19081>
_______________________________________


More information about the Python-bugs-list mailing list