Python 3.12 `tempfile.mkdtemp()` change impacts `--flat` behavior
Closed this issue · 1 comments
In Python 3.12 or later, dtrx --flat
no longer behaves as expected which appears to be due to tempfile.mkdtemp()
change:
Changed in version 3.12: mkdtemp() now always returns an absolute path, even if dir is relative.
One workaround could be to restore Python 3.11 output with something like os.path.join(".", os.path.relpath( ... ))
.
Alternatively may want to fix code so that absolute paths are handled correctly.
Should be easily reproducible by using Python 3.12 or 3.13 and then doing a simple test like
touch test1 test2 test3
zip test.zip test1 test2 test3
rm test1 test2 test3
dtrx --flat test.zip
Seen in Homebrew a while back when trying to update dtrx
to Python 3.12 since testcase runs dtrx --flat test.zip
, e.g. Homebrew/homebrew-core#151052
Probably impacts package on Linux distros that are using Python 3.12 (many rolling release) or 3.13 (e.g. Fedora 41+). For example, Alpine uses Python 3.12 as dependency for dtrx
https://pkgs.alpinelinux.org/package/edge/community/x86_64/dtrx
Thanks for reporting this. I'm working on it.