TerrorJack opened issue #6239:
Test Case
#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> int main(int argc, char *argv[]) { int fd = open("/dev/random", O_RDONLY); fd_set readfds, writefds, errorfds; FD_ZERO(&readfds); FD_SET(fd, &readfds); FD_ZERO(&writefds); FD_ZERO(&errorfds); if (select(fd + 1, &readfds, &writefds, &errorfds, NULL) == -1) { perror(strerror(errno)); exit(errno); } }
Steps to Reproduce
Use wasi-sdk to compile the example above and run it:
$ clang random.c -o random.wasm $ wasmtime run --mapdir /::/ -- random.wasm Invalid argument: Invalid argument
If the same program is compiled by host gcc, it runs fine. Also, it works with nodejs/uvwasi.
Versions and Environment
Wasmtime version or commit: wasmtime-cli 7.0.0
Operating system: Ubuntu 22.10
Architecture: x86_64
TerrorJack labeled issue #6239:
Test Case
#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> int main(int argc, char *argv[]) { int fd = open("/dev/random", O_RDONLY); fd_set readfds, writefds, errorfds; FD_ZERO(&readfds); FD_SET(fd, &readfds); FD_ZERO(&writefds); FD_ZERO(&errorfds); if (select(fd + 1, &readfds, &writefds, &errorfds, NULL) == -1) { perror(strerror(errno)); exit(errno); } }
Steps to Reproduce
Use wasi-sdk to compile the example above and run it:
$ clang random.c -o random.wasm $ wasmtime run --mapdir /::/ -- random.wasm Invalid argument: Invalid argument
If the same program is compiled by host gcc, it runs fine. Also, it works with nodejs/uvwasi.
Versions and Environment
Wasmtime version or commit: wasmtime-cli 7.0.0
Operating system: Ubuntu 22.10
Architecture: x86_64
TerrorJack commented on issue #6239:
Likewise for
/dev/null
. Reading from it should always return an EOF instead of failing with "invalid argument".
sunfishcode commented on issue #6239:
This is a bug in system-interface. I'm working on a fix.
sunfishcode closed issue #6239:
Test Case
#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> int main(int argc, char *argv[]) { int fd = open("/dev/random", O_RDONLY); fd_set readfds, writefds, errorfds; FD_ZERO(&readfds); FD_SET(fd, &readfds); FD_ZERO(&writefds); FD_ZERO(&errorfds); if (select(fd + 1, &readfds, &writefds, &errorfds, NULL) == -1) { perror(strerror(errno)); exit(errno); } }
Steps to Reproduce
Use wasi-sdk to compile the example above and run it:
$ clang random.c -o random.wasm $ wasmtime run --mapdir /::/ -- random.wasm Invalid argument: Invalid argument
If the same program is compiled by host gcc, it runs fine. Also, it works with nodejs/uvwasi.
Versions and Environment
Wasmtime version or commit: wasmtime-cli 7.0.0
Operating system: Ubuntu 22.10
Architecture: x86_64
Last updated: Nov 22 2024 at 16:03 UTC