Skip to content
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

Don't try to report file size or timestamps for stdio streams. #4531

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

sunfishcode
Copy link
Member

Calling File::metadata() on a stdio stream handle fails on Windows, where
the stdio streams are not files.

This File::metadata() call was effectively only being used to add file size
and timestamps to the result of filestat_get. It's common for users to
redirect stdio streams to interesting places, and applications
generally shouldn't change their behavior depending on the size or
timestamps of the file, if the streams are redirected to a file, so just
leave these fields to 0, which is commonly understood to represent
"unknown".

Fixes #4497.

Calling `File::metadata()` on a stdio stream handle fails on Windows, where
the stdio streams are not files.

This `File::metadata()` call was effectively only being used to add file size
and timestamps to the result of `filestat_get`. It's common for users to
redirect stdio streams to interesting places, and applications
generally shouldn't change their behavior depending on the size or
timestamps of the file, if the streams are redirected to a file, so just
leave these fields to 0, which is commonly understood to represent
"unknown".

Fixes bytecodealliance#4497.
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Jul 26, 2022
@github-actions
Copy link

Subscribe to Label Action

cc @kubkon

This issue or pull request has been labeled: "wasi"

Thus the following users have been cc'd because of the following labels:

  • kubkon: wasi

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@sunfishcode sunfishcode merged commit 0e6ffd0 into bytecodealliance:main Jul 26, 2022
@sunfishcode sunfishcode deleted the stdio-stat branch July 26, 2022 22:53
yamt added a commit to yamt/wasi-testsuite that referenced this pull request Feb 28, 2023
Because it seems testing something very specific to wasmtime.

cf. bytecodealliance/wasmtime#4531
loganek pushed a commit to WebAssembly/wasi-testsuite that referenced this pull request Aug 29, 2023
Because it seems testing something very specific to wasmtime.

cf. bytecodealliance/wasmtime#4531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__wasi_fd_filestat_get has an error on Windows.
2 participants