Author val.shkolnikov
Recipients val.shkolnikov
Date 2021-02-02.04:35:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The list() method of TarFile tarfile object shows question mark in place of file type in verbose mode. For instance
python3 -m tarfile -v -l my.tar
?rwxr-xr-x vals/users          0 2021-01-16 18:28:30 bin/
?rwxr-x--- vals/users        266 2021-01-16 18:28:30 bin/
?rwxr-xr-x vals/users        950 2018-01-02 10:39:18 bin/
?rwxrwxrwx vals/users          0 2021-01-16 11:49:36 bin/source-highlight -> ../source-highlight/bin/source-highlight
?rwxr-xr-x vals/users        435 2011-03-27 15:38:06 bin/

This is because the call stat.filemode(tarinfo.mode) does not pass tarinfo.type to stat.filemode. The type needs to be properly encoded and added to the argument.

My patch is attached. Verified under Linux, Cygwin and Windows.
Date User Action Args
2021-02-02 04:35:47val.shkolnikovsetrecipients: + val.shkolnikov
2021-02-02 04:35:47val.shkolnikovsetmessageid: <>
2021-02-02 04:35:47val.shkolnikovlinkissue43098 messages
2021-02-02 04:35:46val.shkolnikovcreate