[New-bugs-announce] [issue43098] tarfile list() method does not show file type

Val Shkolnikov report at bugs.python.org
Mon Feb 1 23:35:47 EST 2021


New submission from Val Shkolnikov <val at nvsoft.net>:

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/backmine.sh
?rwxr-xr-x vals/users        950 2018-01-02 10:39:18 bin/tm.sh
?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/dd.sh

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.

----------
files: patch
messages: 386129
nosy: val.shkolnikov
priority: normal
severity: normal
status: open
title: tarfile list() method does not show file type
type: behavior
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49786/patch

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


More information about the New-bugs-announce mailing list