Python's tarfile module ignores errors during extraction by default, unless errorlevel
is set to either 1
or 2
(or debug
to 1
if only error messages need to be printed).
Try doing a mkdir /tmp/foo && sudo chown root /tmp/foo && chmod a-w /tmp/foo
and using tarfile
to extract a .tar.gz file over /tmp/foo
-- you will see that your Python code threw no exceptions at all. The files would not have been extracted over /tmp/foo
which still is an empty directory.
Why this behavior? Who/what benefits from this default behavior? In other words, just who/what would want to ignore, say, permissions errors when decompressing a tarfile?