Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stat fields wrong for files accessed over CIFS/SMB on Windows starting with 0f175766e2 #105212

Closed
jwbowen opened this issue Jun 1, 2023 · 3 comments
Labels
OS-windows type-bug An unexpected behavior, bug, or error

Comments

@jwbowen
Copy link

jwbowen commented Jun 1, 2023

Bug report

After upgrading Python beyond 3.12a6 on Windows (I've been playing with pathlib.Path.walk), the stat fields returned by os.stat() and pathlib.Path.stat() seem incorrect; in particular the time fields are all 0.

I'm a Unix person turned NAS admin and there's a lot of change with the Windows stat API in that commit, so I'm not qualified to venture guesses about what's going on.

If nas is a CIFS/SMB server, then with the following code

import os
import pathlib

testfile = r'\\nas\share$\path\to\testfile.txt'

print(os.stat(testfile))
print(pathlib.Path(testfile).stat())

prints (with output broken up to avoid scrolling)

os.stat_result(st_mode=33206, st_ino=3648649231342060167, st_dev=2147484764, st_nlink=1, st_uid=0, st_gid=0,
               st_size=5236, st_atime=1682947862, st_mtime=1681251888, st_ctime=1680643578)
os.stat_result(st_mode=33206, st_ino=3648649231342060167, st_dev=2147484764, st_nlink=1, st_uid=0, st_gid=0,
               st_size=5236, st_atime=1682947862, st_mtime=1681251888, st_ctime=1680643578)

before commit 0f17576 and

os.stat_result(st_mode=24576, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0,
               st_size=0, st_atime=0, st_mtime=0, st_ctime=0)
os.stat_result(st_mode=24576, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0,
               st_size=0, st_atime=0, st_mtime=0, st_ctime=0)

after.

Your environment

  • CPython versions tested on: tagged releases 3.12a6, 3.12a7, and 3.12b1; a few commits between a6 and a7 when bisecting down to the issue. The "before/working" code above was compiled (with PCbuild\build.bat -e -p x64) at commit e108af6 and the "after/broken" at commit 0f17576.
  • Operating system and architecture: A Windows Server 2019 VM running on VMware 7.0U3 on an Intel Cascade Lake Xeon (x86_64). Selections from systeminfo
OS Name:                   Microsoft Windows Server 2019 Standard
OS Version:                10.0.17763 N/A Build 17763
...<snip>...
System Model:              VMware7,1
System Type:               x64-based PC
...<snip>...
BIOS Version:              VMware, Inc. VMW71.00V.17369862.B64.2012240522, 12/24/2020

The file share I'm accessing is on a NetApp NAS running ONTAP 9.8P18 and was accessed over SMB 3.1.

@jwbowen jwbowen added the type-bug An unexpected behavior, bug, or error label Jun 1, 2023
@AlexWaygood
Copy link
Member

Cc. @zooba

@eryksun
Copy link
Contributor

eryksun commented Jun 1, 2023

Note that st_mode is 24576 (0x6000), i.e. S_IFBLK. This is the same underlying problem as issue #104820. The fix will be in the next beta release.

@eryksun eryksun closed this as completed Jun 1, 2023
@jwbowen
Copy link
Author

jwbowen commented Jun 2, 2023

Ah, thank you, I didn't know what to make of that value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants