-
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
Truncate file ? #4258
Comments
This might be a bug in our in-memory That said, we weren't able to get your code working on either MacOS or Linux to see what the behaviour should be like on a POSIX-compliant machine. @orangeC23 are you able to run it natively on your Ubuntu (i.e. compiling to x86, not wasm) and let us know what the output looks like? |
Thanks for your answer. However, although other runtimes could print:
, Ubuntu natively prints:
|
@orangeC23 However, wasmer should also error out when the length is zero, so I'll keep this issue open to track that. |
Just noticed #4257. Closing this as it's a duplicate. |
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? |
Reproduction steps
(1)The cfile is :
(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, wasmedge and wazero print:
Actual behavior
The file size before executing is 30. And in the docs of func
posix_fallocate
claimed that if offet value adding start value is not larger than the file size, the file size should keep the initial value.https://pubs.opengroup.org/onlinepubs/9699919799/nframe.html
Expected behavior
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: