Repository navigation
fix: empty stat-family paths - #882
Merged
Merged
Conversation
alexcrichton
left a comment
Collaborator
There was a problem hiding this comment.
I'm not entirely sure why, but the tests on CI look like they're failing:
87/219 Test #157: stat.wasm ...................................***Failed 0.05 sec
/home/runner/work/wasi-libc/wasi-libc/test/src/stat.c:32: stat("", &st) == -1 && errno == ENOENT failed: errno = Success
/home/runner/work/wasi-libc/wasi-libc/test/src/stat.c:34: lstat("", &st) == -1 && errno == ENOENT failed: errno = Success
|
|
||
| int __wasilibc_nocwd_fstatat(int fd, const char *restrict path, struct stat *restrict buf, | ||
| int flag) { | ||
| if (path[0] == '\0') { |
Collaborator
There was a problem hiding this comment.
Should this also check flag for AT_EMPTY_PATH and skip this check in that case?
Contributor
Author
There was a problem hiding this comment.
I agree with you it should be taken into account. I was looking into POSIX.1-2017 documentation, which does not reference the flag, so I will update the description pointing to POSIX.1-2024 docs.
eduardomourar
force-pushed
the
fix/empty-stat-paths
branch
3 times, most recently
from
September 30, 2026 22:24
6c0e038 to
059da59
Compare
eduardomourar
force-pushed
the
fix/empty-stat-paths
branch
from
September 30, 2026 22:45
059da59 to
e2cad9f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Return
ENOENTfromstat,lstat, andfstatatfor an empty pathname, instead of resolving to the preopened directory. AddAT_EMPTY_PATHsupport tofstatat, which operates on the descriptor itself when the path is empty.Closes #881.
POSIX
stat()requiresENOENTfor an emptypath.