yagehu added the bug label to Issue #7583.
yagehu opened issue #7583:
Test Case
Compile the below C code with wasi-sdk.
#include <fcntl.h> #include <string.h> #include <stdio.h> #include <unistd.h> int main() { int f = open("tmp/a", O_CREAT | O_WRONLY | O_APPEND); if (f == -1) perror("open"); int offset = lseek(f, 0, SEEK_CUR); printf("offset before write %d\n", offset); int written = write(f, "abc", 4); printf("written %d bytes\n", written); offset = lseek(f, 0, SEEK_CUR); printf("offset after write %d\n", offset); }
Steps to Reproduce
- Compile the C code with wasi-sdk to a WASM file say: a.wasm
- Run the code mounting an empty directory:
wasmtime run --dir tmp a.wasm
Expected Results
fd_tell should report the actual fd offset equal to bytes written.
offset before write 0 written 4 bytes offset after write 4
Actual Results
fd_tell always reports 0.
offset before write 0 written 4 bytes offset after write 0
Versions and Environment
Wasmtime v15.0.0
Operating system: Fedora 39
Architecture: amd64
Extra Info
alexcrichton commented on issue #7583:
cc @pchickey I think this is a bug with
-Spreview2
. If-Spreview2=n
is specified I believe this achieves the desired behavior.
pchickey closed issue #7583:
Test Case
Compile the below C code with wasi-sdk.
#include <fcntl.h> #include <string.h> #include <stdio.h> #include <unistd.h> int main() { int f = open("tmp/a", O_CREAT | O_WRONLY | O_APPEND); if (f == -1) perror("open"); int offset = lseek(f, 0, SEEK_CUR); printf("offset before write %d\n", offset); int written = write(f, "abc", 4); printf("written %d bytes\n", written); offset = lseek(f, 0, SEEK_CUR); printf("offset after write %d\n", offset); }
Steps to Reproduce
- Compile the C code with wasi-sdk to a WASM file say: a.wasm
- Run the code mounting an empty directory:
wasmtime run --dir tmp a.wasm
Expected Results
fd_tell should report the actual fd offset equal to bytes written.
offset before write 0 written 4 bytes offset after write 4
Actual Results
fd_tell always reports 0.
offset before write 0 written 4 bytes offset after write 0
Versions and Environment
Wasmtime v15.0.0
Operating system: Fedora 39
Architecture: amd64
Extra Info
Last updated: Nov 22 2024 at 16:03 UTC