python / python/cpython

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

Open
#92,327 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-windows type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the Windows implementation behind os.lstat, especially its GetFileInformationByHandleEx call with FileAttributeTagInfo. Reproduce the case against the NetApp junction and compare it with DeviceIoControl using FSCTL_GET_REPARSE_POINT. Done means st_reparse_tag reports the remote junction's reparse tag while preserving behavior for regular Windows shares.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.