Skip to content

Preserve and classify native Windows filesystem errors #523

Closed

Description

@LunaStev

The portable filesystem entry point promises negative errno-style failures, but the Windows implementation returns a constant -1 for most native API failures. Missing paths, denied access, invalid handles and sharing violations lose their identity before reaching callers. Substituting raw -GetLastError() everywhere would also be insufficient: Win32 codes and the portable errno domain are not interchangeable.

Source evidence at the head of #520:

Acceptance:

  • Capture GetLastError immediately after each failed filesystem API, before cleanup can overwrite it.
  • Centralize translation to the existing portable error convention; retain useful native detail where the error representation supports it.
  • Exercise missing file, denied operation, invalid handle and sharing conflict on native Windows; distinguish the returned errors.
  • Use native Windows APIs; do not add libc bindings.

Related: #385 is the provider umbrella; #508 concerns network errors and does not cover filesystem failures.

Audit status: identified by static source inspection; the scenarios above have not been executed during this audit. The permalink fixes the reviewed revision; this report does not claim the defect was introduced by #520.

Activity

  1. added
    bug
    help wanted
    os-specific bug
    on Sep 8, 2026
  2. self-assigned this
    on Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughelp wantedos-specific bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions