-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error allocating file ? #4257
Comments
This may be caused by the same underlying problem as #4258. |
This happens because wasmer's implementation does not error out when the length argument to |
Thanks a lot for your answer!
The file size before executing is 30. When executing the Wasm file, wasmer prints:
And the file content is truncated. Other runtimes print:
Could this be an error? Could this be an error of wasmer or an error of other runtimes? |
Oh, that changes a lot. |
Maybe this bug could be fixed in the lib/wasix/src/syscalls/wasi/fd_allocate.rs file. The size of the file, cur_size, can be obtained through Fd. By comparing the sizes of cur_size and new_size, it can be determined whether the file should be allocated a new size, thus avoiding the issue of truncating the file content. |
Reproduction steps
(2)compile the c file into wasm:
./wasi-sdk-16.0/bin/clang --target=wasm32-unkown-wasi --sysroot=./wasi-sdk-16.0/share/wasi-sysroot test1.c -o test1.wasm
(3)exeute open.wasm
wasmer run test1.wasm --dir=./Data
The permission of Data/hello.txt is 0600 or 0700, user1 create the Data/hello.txt file and user1 execute the Wasm file.
(4)wasmer prints:
However, other runtime and compile the C file into native (
gcc test1.c -o test1
) and directly execute it prints:Actual behavior
Expected behavior
Error allocating file space: Success
Enter snapshot
Error getting file attributes: Bad file descriptor
wasmer version
4.2.2
Operating system information
Ubuntu 20.04
Hardware Architecture
x86_64
The text was updated successfully, but these errors were encountered: