Skip to content
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

Appending to file does not work #936

Closed
leonardas103 opened this issue Nov 8, 2019 · 5 comments · Fixed by #939
Closed

Appending to file does not work #936

leonardas103 opened this issue Nov 8, 2019 · 5 comments · Fixed by #939
Labels
❓ question I've a question!

Comments

@leonardas103
Copy link

leonardas103 commented Nov 8, 2019

I am trying to run a simple wasm program, see code here

I am running: wasmer run --dir=. demo.wasm '{"a":"txt", "b":1}'
which should append txt 1 to a log.txt file.

However, the data is not appending but instead writing over. The same program compiled with native Rust (non-wasm) appends properly.

@leonardas103 leonardas103 added the ❓ question I've a question! label Nov 8, 2019
@CryZe
Copy link
Contributor

CryZe commented Nov 8, 2019

If you execute it with wasmtime, does it have the same problem?

@CryZe
Copy link
Contributor

CryZe commented Nov 8, 2019

Looks like there's no logic for append here: https://github.com/wasmerio/wasmer/blob/master/lib/wasi/src/syscalls/mod.rs#L1726-L1742

@leonardas103
Copy link
Author

If you execute it with wasmtime, does it have the same problem?

With wasmtime the program does not execute at all, I get the following error:

thread 'main' panicked at 'write failed: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', src/libcore/result.rs:1084:5

@CryZe
Copy link
Contributor

CryZe commented Nov 8, 2019

Seems like it's an fdflag __WASI_FDFLAG_APPEND

@MarkMcCaskey
Copy link
Contributor

Thanks for reporting this! I'll investigate and ship a fix

bors bot added a commit that referenced this issue Nov 8, 2019
939: Fix WASI append bug, add test r=MarkMcCaskey a=MarkMcCaskey

resolves #936 

Co-authored-by: Mark McCaskey <[email protected]>
bors bot added a commit that referenced this issue Nov 8, 2019
939: Fix WASI append bug, add test r=syrusakbary a=MarkMcCaskey

resolves #936 

Co-authored-by: Mark McCaskey <[email protected]>
Co-authored-by: Syrus Akbary <[email protected]>
bors bot added a commit that referenced this issue Nov 8, 2019
938: Fuzz all the backends. r=nlewycky a=nlewycky

![](https://i.imgflip.com/3fq2bw.jpg)


939: Fix WASI append bug, add test r=MarkMcCaskey a=MarkMcCaskey

resolves #936 

Co-authored-by: Nick Lewycky <[email protected]>
Co-authored-by: Mark McCaskey <[email protected]>
Co-authored-by: Syrus Akbary <[email protected]>
bors bot added a commit that referenced this issue Nov 9, 2019
939: Fix WASI append bug, add test r=MarkMcCaskey a=MarkMcCaskey

resolves #936 

Co-authored-by: Mark McCaskey <[email protected]>
Co-authored-by: Syrus Akbary <[email protected]>
@bors bors bot closed this as completed in 0d644a5 Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question I've a question!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants