python / python/cpython

os.lstat doesn't properly set st_reparse_tag for junction on a remote NetApp share

未關閉
#92,327 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

OS-windows type-bug
主要語言
Python
星號
77.2k
分支
36k
平均合併
1 天 9 小時
30 天內合併 PR
558

描述

Bug report

\\192.168.10.198\vol1\sub is a junction on NetApp share, but in Python 3.10.4 st_reparse_tag is set to 0:

>>> path = "\\\\192.168.10.198\\vol1\\sub"
>>> os.lstat(path).st_reparse_tag
0
>fsutil reparsepoint query \\192.168.10.198\vol1\sub
Reparse Tag Value : 0xa0000003
Tag value: Microsoft
Tag value: Name Surrogate
Tag value: Mount Point
Substitue Name offset: 0
Substitue Name length: 98
Print Name offset:     100
Print Name Length:     98
Substitute Name:       \??\Volume{804BBB02-0000-0000-6270-052200000040}\
Print Name:            \??\Volume{804BBB02-0000-0000-6270-052200000040}\

I checked in the Python code that:

  • os.lstat uses GetFileInformationByHandleEx call with FileAttributeTagInfo to get the value of the reparse tag
  • DeviceIoControl with FSCTL_GET_REPARSE_POINT, which is also used in Python source code, works fine
  • the problem doesn't affect regular remote Windows shares (NTFS filesystem)

Your environment

  • CPython versions tested on: 3.10.4
  • Operating system and architecture: Windows 2019, NetApp share

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先檢查 os.lstat 背後的 Windows 實作,尤其是使用 FileAttributeTagInfo 呼叫 GetFileInformationByHandleEx 的部分。針對 NetApp junction 重現此情況,並將其與使用 FSCTL_GET_REPARSE_POINT 的 DeviceIoControl 進行比較。完成的標準是 st_reparse_tag 回報遠端 junction 的 reparse tag,同時維持對一般 Windows 共用的行為不變。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
operating-systems
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。