Test Case
When calling fseek(f, 0, SEEK_END) on a FIFO from a WASI module,
wasmtime returns 0 (success) instead of an error. This makes it impossible to
detect non-seekable streams from within WASI code.
This seems to be a regression: it fails with wasmtime-py 41.0.0, wasmtime-py 42.0.0,
wasmtime CLI 44.0.0, but seems to work with a wasmtime 11.0 which I happened to have around.
The correct return value should be -1, but broken versions return 0.
Native Linux and wasmer 7.1.0 both correctly return -1.
// test_fifo_seek.c
#include <stdio.h>
int main(int argc, char **argv) {
FILE *f = fopen(argv[1], "r");
if (!f) { printf("fopen failed\n"); return 1; }
long cur = ftell(f);
printf("ftell: %ld\n", cur);
int r = fseek(f, 0, SEEK_END);
printf("fseek SEEK_END: %d\n", r);
printf("ftell after SEEK_END: %ld\n", ftell(f));
fclose(f);
return 0;
}
Steps to Reproduce
Compile to WASI (here I'm using zig 0.13.0):
zig cc --target=wasm32-wasi-musl -o test_fifo_seek.wasm test_fifo_seek.c
Run:
mkfifo /tmp/fifo
echo -n "hello" > /tmp/fifo &
wasmtime run --dir /tmp test_fifo_seek.wasm /tmp/fifo
Expected Results
ftell: -1
fseek SEEK_END: -1
ftell after SEEK_END: -1
Actual Results
ftell: 0
fseek SEEK_END: 0
ftell after SEEK_END: 0
Versions and Environment
41.0.0, 42.0.0, 44.0.0
Operating system: Linux (ubuntu)
Architecture: x86_64
Test Case
When calling
fseek(f, 0, SEEK_END)on a FIFO from a WASI module,wasmtime returns 0 (success) instead of an error. This makes it impossible to
detect non-seekable streams from within WASI code.
This seems to be a regression: it fails with wasmtime-py 41.0.0, wasmtime-py 42.0.0,
wasmtime CLI 44.0.0, but seems to work with a wasmtime 11.0 which I happened to have around.
The correct return value should be -1, but broken versions return 0.
Native Linux and wasmer 7.1.0 both correctly return -1.
Steps to Reproduce
Compile to WASI (here I'm using zig 0.13.0):
Run:
Expected Results
Actual Results
Versions and Environment
41.0.0, 42.0.0, 44.0.0
Operating system: Linux (ubuntu)
Architecture: x86_64