[New-bugs-announce] [issue47231] TarFile.getmember cannot work on tar sourced directory over 100 characters

Chris Fernald report at bugs.python.org
Tue Apr 5 14:15:20 EDT 2022


New submission from Chris Fernald <chris.fernald at utexas.edu>:

A fix was made to unify handling of the trailing slash in TarFile.getmember related to https://bugs.python.org/issue21987. This change fixed the <100 character case, but made it so directories over 100 character which come from a tar file can no longer be accessed through getmember, even if returned from getnames. This appears to be because internal to tarfile, member names still include the trailing slash on directories over 100 characters but getmember will always remove the trailing slash from the provided name so the comparison will always fail.

A simple example of this is as follows using 3.10.4.

1. Download: https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz

2. place attached python script in same directory

3. run on 3.8.2 -> fails to get stripped version of path (line 16)

4. run on 3.10.4 -> fails to get even unstripped version (line 12 & 16)

----------
components: Library (Lib)
files: tarfile_repro.py
messages: 416793
nosy: cfernald, serhiy.storchaka
priority: normal
severity: normal
status: open
title: TarFile.getmember cannot work on tar sourced directory over 100 characters
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9
Added file: https://bugs.python.org/file50721/tarfile_repro.py

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


More information about the New-bugs-announce mailing list