TarFile.extractall() doesn't properly handle UNC paths
未關閉
還沒有人認領這個 Issue。
OS-windows
stdlib
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
TarFile.extractall() does not perform path normalization before calling os.lstat(). This is an issue on Windows as the resulting path ends us using Windows-style (\\) and unix-style (/) path separators. This results in the following error: OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '\\\\?\\Z:\\extracted\\double-conversion-v3.1.4.tar.gz\\double-conversion-3.1.4/test/cctest'.
from Lib import tarfile
with tarfile.open(r'\\?\Z:\downloads\double-conversion-v3.1.4.tar.gz') as t:
t.extractall(r'\\?\Z:\extracted\double-conversion-v3.1.4.tar.gz')
CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Windows
Linked PRs
- gh-143665
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Lib/tarfile 開始,使用 issue 中所示的 Windows UNC 樣式路徑重現回報的 TarFile.extractall() 情況。追蹤傳遞給 os.lstat() 的路徑;完成的標準是該範例在 Windows 上不再引發所回報的 WinError。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- operating-systems
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100