-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
std.fs: improve error-handling for openDirW #14533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
My understanding is the the The relevant code for that would be within this loop: Line 1035 in 289e8fa
I'm unsure what validation should be done in particular--is it required for search paths to be absolute? If so, then an EDIT: Seems like relative paths do/can work in |
I've noticed a few places where I couldn't find a function which reliably validates path, there's |
Why does Do you want to make a PR or do you want me to create one? Specifically the cases |
Relative paths are allowed as search paths in We'll likely need a function that actually validates paths (not sure if there's much precedence for this?), or abandon the |
If you decide to do the validation with |
@andrewrk if it makes this easier to review, this PR is a very targeted change to fix one particular manifestation (bad path in My personal opinion about this particular PR:
|
Scenario where the bug manifests itself in a real use-case.
While adding a cmake dependency to
build.zig
with:I've encountered
unreachable
which was caused by this line. It turns out my%PATH%
had an incorrect entry::\Program Files\7-Zip
- notice noC
at the start.So what happens is that as part of
spawnWindows
Zig searches through each%PATH%
entry to find an absolute path ofcmake
executable, and instead of skipping an invalid entry we panic on it.You can repro the panic with this MRE:
There's no info in the original commit why it handles it as such, so I assume it's reasonable to treat the error as
error.NotDir
instead.