Skip to content

fix: handle AT_FDCWD with AT_EMPTY_PATH in fstatat - #927

Merged
alexcrichton merged 1 commit into
WebAssembly:mainfrom
eduardomourar:fix/fstatat-at-fdcwd-empty-path
Nov 30, 2026
Merged

alexcrichton merged 1 commit into
WebAssembly:mainfrom
eduardomourar:fix/fstatat-at-fdcwd-empty-path

Conversation

@eduardomourar

@eduardomourar eduardomourar commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • fix: empty stat-family paths #882 made __wasilibc_stat return ENOENT for an empty path, and gave __wasilibc_nocwd_fstatat its own AT_EMPTY_PATH handling for a real dirfd.
  • fstatat's AT_FDCWD dispatch in at_fdcwd.c routes straight into __wasilibc_stat(pathname, ...) without checking AT_EMPTY_PATH first, so fstatat(AT_FDCWD, "", buf, AT_EMPTY_PATH) incorrectly returned ENOENT instead of statting the current working directory.
  • This adds the same AT_EMPTY_PATH check to the AT_FDCWD dispatch, resolving an empty path with AT_EMPTY_PATH to ".".

Test plan

  • Added fstatat(AT_FDCWD, "", ...) cases to test/src/stat.c, mirroring the existing dirfd cases added in fix: empty stat-family paths #882.
  • CI run on the usual WASI targets.

@eduardomourar
eduardomourar force-pushed the fix/fstatat-at-fdcwd-empty-path branch from dc66e05 to b81be4b Compare November 29, 2026 13:41
@alexcrichton
alexcrichton merged commit 855ca08 into WebAssembly:main Nov 30, 2026
37 checks passed
@eduardomourar
eduardomourar deleted the fix/fstatat-at-fdcwd-empty-path branch November 30, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants