abc767234318 labeled issue #4497:
Test Case
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <wasi/api.h> int main(int argc, char **argv) { __wasi_fdstat_t statbuf; printf("__wasi_fd_fdstat_get for stdout: %d\n", __wasi_fd_fdstat_get(fileno(stdout), &statbuf)); printf("rights for stdout: %llu\n", statbuf.fs_rights_base); printf("type for stdout: %d\n", statbuf.fs_filetype); printf("has filestat_get rights for stdout: %s\n", (statbuf.fs_rights_base & __WASI_RIGHTS_FD_FILESTAT_GET) != 0 ? "yes" : "no"); __wasi_filestat_t filestat; int filestat_res = __wasi_fd_filestat_get(fileno(stdout), &filestat); printf("__wasi_fd_filestat_get for stdout: %d\n", filestat_res); if (filestat_res != 0) { printf(" E: __wasi_fd_filestat_get returned error: %d\n", filestat_res); } struct stat sb; int f = fstat(fileno(stdout), &sb); printf("fstat for stdout (fd: %d): %d\n", fileno(stdout), f); if (f < 0) { perror(" E: fstat returned error"); } return 0; }
This is a source code first mentioned in #2515
fstat.wasm.zipSteps to Reproduce
wasmtime fstat.wasm
Expected Results
Program execution without error
Actual Results
__wasi_fd_fdstat_get for stdout: 0 rights for stdout: 148898267 type for stdout: 2 has filestat_get rights for stdout: yes Error: failed to run main module `fstat.wasm` Caused by: 0: failed to invoke command default 1: Unknown OS error Caused by: 函数不正确。(Incorrect function) (os error 1) wasm backtrace: 0: 0x2b5f - <unknown>!__wasi_fd_filestat_get 1: 0x3cb - <unknown>!main 2: 0x2aa8 - <unknown>!__main_void 3: 0x202 - <unknown>!_start 4: 0x6694 - <unknown>!_start.command_export
Versions and Environment
Wasmtime version or commit: wasmtime-cli 0.39.0
Operating system: windows
abc767234318 opened issue #4497:
Test Case
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <wasi/api.h> int main(int argc, char **argv) { __wasi_fdstat_t statbuf; printf("__wasi_fd_fdstat_get for stdout: %d\n", __wasi_fd_fdstat_get(fileno(stdout), &statbuf)); printf("rights for stdout: %llu\n", statbuf.fs_rights_base); printf("type for stdout: %d\n", statbuf.fs_filetype); printf("has filestat_get rights for stdout: %s\n", (statbuf.fs_rights_base & __WASI_RIGHTS_FD_FILESTAT_GET) != 0 ? "yes" : "no"); __wasi_filestat_t filestat; int filestat_res = __wasi_fd_filestat_get(fileno(stdout), &filestat); printf("__wasi_fd_filestat_get for stdout: %d\n", filestat_res); if (filestat_res != 0) { printf(" E: __wasi_fd_filestat_get returned error: %d\n", filestat_res); } struct stat sb; int f = fstat(fileno(stdout), &sb); printf("fstat for stdout (fd: %d): %d\n", fileno(stdout), f); if (f < 0) { perror(" E: fstat returned error"); } return 0; }
This is a source code first mentioned in #2515
fstat.wasm.zipSteps to Reproduce
wasmtime fstat.wasm
Expected Results
Program execution without error
Actual Results
__wasi_fd_fdstat_get for stdout: 0 rights for stdout: 148898267 type for stdout: 2 has filestat_get rights for stdout: yes Error: failed to run main module `fstat.wasm` Caused by: 0: failed to invoke command default 1: Unknown OS error Caused by: 函数不正确。(Incorrect function) (os error 1) wasm backtrace: 0: 0x2b5f - <unknown>!__wasi_fd_filestat_get 1: 0x3cb - <unknown>!main 2: 0x2aa8 - <unknown>!__main_void 3: 0x202 - <unknown>!_start 4: 0x6694 - <unknown>!_start.command_export
Versions and Environment
Wasmtime version or commit: wasmtime-cli 0.39.0
Operating system: windows
sunfishcode commented on issue #4497:
Thanks for the report! I've now filed #4531 with a fix.
sunfishcode closed issue #4497:
Test Case
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <wasi/api.h> int main(int argc, char **argv) { __wasi_fdstat_t statbuf; printf("__wasi_fd_fdstat_get for stdout: %d\n", __wasi_fd_fdstat_get(fileno(stdout), &statbuf)); printf("rights for stdout: %llu\n", statbuf.fs_rights_base); printf("type for stdout: %d\n", statbuf.fs_filetype); printf("has filestat_get rights for stdout: %s\n", (statbuf.fs_rights_base & __WASI_RIGHTS_FD_FILESTAT_GET) != 0 ? "yes" : "no"); __wasi_filestat_t filestat; int filestat_res = __wasi_fd_filestat_get(fileno(stdout), &filestat); printf("__wasi_fd_filestat_get for stdout: %d\n", filestat_res); if (filestat_res != 0) { printf(" E: __wasi_fd_filestat_get returned error: %d\n", filestat_res); } struct stat sb; int f = fstat(fileno(stdout), &sb); printf("fstat for stdout (fd: %d): %d\n", fileno(stdout), f); if (f < 0) { perror(" E: fstat returned error"); } return 0; }
This is a source code first mentioned in #2515
fstat.wasm.zipSteps to Reproduce
wasmtime fstat.wasm
Expected Results
Program execution without error
Actual Results
__wasi_fd_fdstat_get for stdout: 0 rights for stdout: 148898267 type for stdout: 2 has filestat_get rights for stdout: yes Error: failed to run main module `fstat.wasm` Caused by: 0: failed to invoke command default 1: Unknown OS error Caused by: 函数不正确。(Incorrect function) (os error 1) wasm backtrace: 0: 0x2b5f - <unknown>!__wasi_fd_filestat_get 1: 0x3cb - <unknown>!main 2: 0x2aa8 - <unknown>!__main_void 3: 0x202 - <unknown>!_start 4: 0x6694 - <unknown>!_start.command_export
Versions and Environment
Wasmtime version or commit: wasmtime-cli 0.39.0
Operating system: windows
Last updated: Nov 22 2024 at 16:03 UTC