GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — os.fstat() fails on FAT32 file system on Windows · Issue #111856 · python/cpython

os.fstat() fails on FAT32 file system on Windows #111856

New issue
Copy link
New issue
Copy link
Closed
Closed
os.fstat() fails on FAT32 file system on Windows#111856
Copy link
Labels
OS-windowstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@adang1345
adang1345
opened on Nov 8, 2023
Issue body actions

Bug report

Bug description:

This is Python 3.12.0 x64 running on Windows 11. On a FAT32 drive, I have a file f.txt.

>>> import os
>>> os.stat('f.txt')
os.stat_result(st_mode=33206, st_ino=4194560, st_dev=1589430838, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1699419600, st_mtime=1699459266, st_ctime=1699459265)
>>> f = open('f.txt','rb')
>>> f.fileno()
3
>>> os.fstat(f.fileno())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [WinError 87] The parameter is incorrect

This error does not occur with Python 3.11.6. I suspect that the issue was introduced with #102149. 6031727 provided a fix for os.stat(), but it seems that an equivalent bug exists for os.fstat().

I believe the fix would involve changing the line https://github.com/python/cpython/blob/74b868f636a8af9e5540e3315de666500147d47a/Python/fileutils.c#L1275C48-L1275C48 to account for the possibility that the file system does not support FileIdInfo.

CPython versions tested on:

3.12

Operating systems tested on:

Windows

Linked PRs

  • gh-111856: fix os.fstat on windows with fat32 and exfat filesystem #112038
  • [3.12] gh-111856: Fix os.fstat on windows with FAT32 and exFAT filesystem (GH-112038) #112044

Activity

  1. adang1345
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Nov 8, 2023
  2. terryjreedy
    added
    OS-windows
    on Nov 8, 2023
  3. zooba
    added a commit that references this issue on Nov 13, 2023

    gh-111856: Fix os.fstat on windows with FAT32 and exFAT filesystem (G…

    29af736
  4. zooba
    closed this as completedon Nov 13, 2023
  5. miss-islington
    added a commit that references this issue on Nov 13, 2023

    pythongh-111856: Fix os.fstat on windows with FAT32 and exFAT filesys…

    41d64a3
  6. zooba commented on Nov 13, 2023

    @zooba
    zooba
    on Nov 13, 2023
    Member
    More actions

    Thanks for the report and the fix!

  7. zooba
    added a commit that references this issue on Nov 13, 2023

    gh-111856: Fix os.fstat on windows with FAT32 and exFAT filesystem (G…

    dfdbfc5
  8. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-111856: Fix os.fstat on windows with FAT32 and exFAT filesys…

    ba6d722
  9. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-111856: Fix os.fstat on windows with FAT32 and exFAT filesys…

    75e2854
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.