Skip to content

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

Merged
sunfishcode merged 2 commits into
bytecodealliance:mainfrom
sunfishcode:stdio-stat
Jul 26, 2022
Merged

Don't try to report file size or timestamps for stdio streams.#4531
sunfishcode merged 2 commits into
bytecodealliance:mainfrom
sunfishcode:stdio-stat

Conversation

@sunfishcode
Copy link
Copy Markdown
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
Copy Markdown

Subscribe to Label Action

cc @kubkon

Details 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