On Mac, lib.std.Dir.realpath
resolves firmlinks but /bin/realpath
does not
#20374
Labels
bug
Observed behavior contradicts documented or intended behavior
os-macos
standard library
This issue involves writing Zig code for the standard library.
Milestone
Zig Version
0.14.0-dev.15+d4bc64038
Steps to Reproduce and Observed Behavior
Now firmlinks are already considered a real problem, but not matching default OS behaviour may or may not also be considered a problem.
Back when I reported that issue I also reported the issue on Rust. The Rust maintainer of the dir walking APIs roundly rejected considering it a bug, which indicates there may be various opinions so we should at least make an official decision.
All mac unix commandline tools I have tried (such as
find
) don't take firmlinks into account. But code written in Swift does.lib.std.Dir.realpath
on Mac is implemented usingposix.system.fcntl
withposix.F.GETPATH
and does not call arealpath
API, in fact I don't think macOS provides one?We could:
Note that the
std.fs.IterableDir.Walker
issue is not solved yet so it does not match the behaviour oflib.std.Dir.realpath
, which could cause confusion.Expected Behavior
The text was updated successfully, but these errors were encountered: