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

未关闭
#92,327 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

首先检查 os.lstat 背后的 Windows 实现,尤其是使用 FileAttributeTagInfo 调用 GetFileInformationByHandleEx 的部分。针对 NetApp junction 重现该情况,并将其与使用 FSCTL_GET_REPARSE_POINT 的 DeviceIoControl 进行比较。完成的标准是 st_reparse_tag 报告远程 junction 的 reparse tag,同时保持对普通 Windows 共享的行为不变。

由索引模型根据 Issue 内容生成。

描述

OS-windows type-bug

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
主要语言
Python
星标
77.2k
派生
36k
平均合并
1 天 9 小时
30 天内合并 PR
558

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

python/cpython 的其他 Issue

查看 python/cpython 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。