emscripten-core / emscripten-core/emscripten

Error errno 29 when FS.write on preloaded data

Open
#20,153 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Version: emscripten/emsdk:3.1.45

To reproduce you need to preload some data, then just call `FS.writeFile('/somepreloadeddata')`. You can find my compile arguments at https://github.com/soyuka/php-wasm/blob/main/Dockerfile but there's nothing fancy. It looks like the data is already open with a cursor somewhere in that file.
What works is to `FS.unlink` first then you're able to `FS.writeFile` again. I've tracked the call to the `write` call at (https://github.com/emscripten-core/emscripten/blob/3a55fe189e2d12298a0350b16fa551c5df5348a1/src/library_fs.js#L1286) and obviously when trying to `write` using `fopen` etc. it also fails.
I'm not sure if we can access current opened file descriptor so that we could try to close the opens one. I'm not even sure why these would be kept open as I haven't mounted anything (on start we probably mount the memfs though but why are these files kept open?).

Anyways, I'm enjoying your work a lot so thanks to everyone working on this project :).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.