This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: TarFile.getmember cannot work on tar sourced directory over 100 characters
类型: behavior Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
状态: open Resolution:
Dependencies: 后续:
分配给: 抄送列表: andrei.avk, cfernald, ethan.furman, r.david.murray, serhiy.storchaka
优先级: normal 关键字:

cfernald2022-04-05 18:15 创建。最近一次由 admin2022-04-11 14:59 修改。

文件
文件名 上传时间 Description 编辑
tarfile_repro.py cfernald, 2022-04-05 18:15 Example of tarfile bug using arm gcc compiler tarfile
Messages (2)
msg416793 - (view) Author: Chris Fernald (cfernald) * 日期: 2022-04-05 18:15
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)
msg416796 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) 日期: 2022-04-05 18:24
Nosied others from issue21987.
历史
日期 用户 动作 参数
2022-04-11 14:59:58admin修改github: 91387
2022-04-05 22:06:10vstinner修改抄送: - vstinner
2022-04-05 18:24:16ethan.furman修改抄送: + vstinner, r.david.murray, ethan.furman, andrei.avk
消息: + msg416796
2022-04-05 18:15:20cfernald创建