You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.os-windowsMicrosoft Windowsstandard libraryThis issue involves writing Zig code for the standard library.
The file window.zig exists, but these fail. Just using zig fmt window.zig works fine.
PS C:\Projects\ZigVulkan> zig fmt .\window.zig
unable to open '.\window.zig': error.FileNotFound
PS C:\Projects\ZigVulkan> zig fmt ./window.zig
unable to open './window.zig': error.BadPathName
As far as I can tell, NtCreateFile treats ObjectName literally and doesn't do any resolving, so it's actually searching for the impossible path C:\Projects\ZigVulkan\.\window.zig. To fix this particular issue, it seems like either paths need to always be resolved before calls to std.fs.openFileWindows or resolved within std.fs.openFileWindows (and other callers of NtCreateFile?).
Also worth noting that .. as a directory in ObjectName is invalid and gives an STATUS_OBJECT_NAME_INVALID error (0xC0000033):
Pre-resolving has huge implications for following symlinks (called/using "reparse points" in NT-speak). I don't think its required, but will need to do some research.
bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.os-windowsMicrosoft Windowsstandard libraryThis issue involves writing Zig code for the standard library.
Activity
squeek502 commentedon Mar 3, 2020
As far as I can tell,
NtCreateFiletreatsObjectNameliterally and doesn't do any resolving, so it's actually searching for the impossible pathC:\Projects\ZigVulkan\.\window.zig. To fix this particular issue, it seems like either paths need to always be resolved before calls tostd.fs.openFileWindowsor resolved withinstd.fs.openFileWindows(and other callers ofNtCreateFile?).Also worth noting that
..as a directory inObjectNameis invalid and gives anSTATUS_OBJECT_NAME_INVALIDerror (0xC0000033):zig fmt ..\test.zig->error.Unexpected NTSTATUS=0xc0000033zig fmt test\..\test.zig->error.Unexpected NTSTATUS=0xc0000033zig fmt test..\test.zig->error.FileNotFound(accurate, that file didn't exist)daurnimator commentedon Mar 3, 2020
Pre-resolving has huge implications for following symlinks (called/using "reparse points" in NT-speak). I don't think its required, but will need to do some research.
squeek502 commentedon Mar 3, 2020
Tiny reproduction:
If
test.zigexists, the first open succeeds, but the second fails, even though they would resolve to the same path.daurnimator commentedon Mar 4, 2020
So I did some research, and processing '..' on windows requires a dance where you use
NtQueryInformationFile+NtOpenFileto traverse up a directory for each time you encounter '..'.There is an example at: https://git.midipix.org/ntapi/tree/src/fs/ntapi_tt_open_physical_parent_directory.c
squeek502 commentedon Apr 28, 2020
This can be closed now (fixed by #5187)