WebAssembly / WebAssembly/WASI
No st_mode from stat?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.8k
- Forks
- 333
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 3
Description
The internal struct used by stat calls does not have a field for the mode of the file (read/write/execute bits), and stat, lstat, fstat, fstatat all return zeros for these bits.
The implementer of the API has no control over that.
Most of the time it's alright, but some code checks file permissions occasionally (esp. execute permission) and behaves unexpectedly when the permissions set in st_mode are in fact lower than the actual permissions for the file.
E.g. excerpt from kpathsea:
if (stat (name, &s) == 0 && s.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)
/* Do not stop at directories. */
&& !S_ISDIR(s.st_mode))
self = name;
else
free (name);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WASI API definition linked at libc-bottom-half/headers/public/wasi/api.h around line 955, then trace how stat, lstat, fstat, and fstatat populate their internal result. Confirm the current zero mode bits and determine the API change needed so permission and file-type information is represented accurately; done means affected callers receive correct st_mode bits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, wasm
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100