std.fs.realpath bugs/inconsistencies on Windows #4658
Labels
bug
Observed behavior contradicts documented or intended behavior
os-windows
standard library
This issue involves writing Zig code for the standard library.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Some related comments can be found in #4655 and #4605. Currently
fs.realpath
/os.realpath
has different/broken symlink resolution behavior on different platforms (or maybe just Windows). The doc comments say:zig/lib/std/os.zig
Lines 3027 to 3032 in eaccfff
Janky test code (
realpath.zig
built viazig build-exe realpath.zig
):On Windows:
Setup:
(expectedrealpath
returnserror.AccessDenied
for directories on Windowsrealpath=C:\tmp\dir
) [Fixed by Windows: Fix std.fs.realpath/os.realpathW for directories #4697]realpath
works correctly for files on Windowsrealpath
resolves files in a symlinked dir on Windowsrealpath
resolves files in a symlinked dir whencwd
is the symlinked dir on Windowsrealpath
does not resolve symlinks before resolving..
on Windows (note: the intended resolution order is not currently specified in therealpath
doc comments)On Linux:
Setup:
realpath
works for directories on Linuxrealpath
works correctly for files on Linuxrealpath
resolves files in a symlinked dir on Linuxrealpath
resolves files in a symlinked dir whencwd
is the symlinked dir on Linuxrealpath
resolves symlinks before resolving..
on Linux (note: the intended resolution order is not currently specified in therealpath
doc comments)The text was updated successfully, but these errors were encountered: