Closed jbaicoianu closed 8 years ago
Emscripten issue is here: kripken/emscripten#3678
I put together a simple harness for running this test. There are two versions:
working, no BFS - http://baicoianu.com/~bai/emscripten-open-test/opentest.html broken, with BFS - http://baicoianu.com/~bai/emscripten-open-test/opentest-bfs.html
Check the console to see the syscall debug messages.
Thanks! I'll take a look at this tonight.
OK. Emscripten is calling open
on a stream
with flags
set to 32768.
The failure is happening because this line is supposed to return a string indicating the open mode (e.g. r
), but 32768 is invalid; it contains a high-level bit which I believe indicates the stream's type. Thus, it doesn't return a string. flagsToPermissionString
should zero the top bits.
Fixing...
@jbaicoianu does this release work? https://github.com/jvilk/BrowserFS/releases/tag/v0.4.2
Let me know, and I'll promote it to an official release.
Thanks for reporting!
Yup, this fixes it, thanks for the quick turnaround!
I pushed out v0.4.4 to NPM and Bower (0.4.2 was a pre-release, and I pushed out an erroneous version of 0.4.3), which contains the fix from the 0.4.2 pre-release. Officially closing (finally!).
I originally filed this bug against emscripten since it started happening after switching to a newer version of the compiler, but @kripken points out that it works when embedding the file directly, so it must be something to do with the interface between BrowserFS and Emscripten.
I'm trying to compile MAME with the latest version of Emscripten (incoming branch), and I'm getting EINVALID whenever I try to call open() on an existing file. Compiling with -s SYSCALL_DEBUG=1 shows this error:
I've isolated this into a bare-bones test case and see the same error there:
Compile with:
emcc opentest.c -o opentest.bc && emcc -O3 opentest.bc -s SYSCALL_DEBUG=1 -o opentest.js
I can read the file in the browser just fine via the FS object:
The file definitely exists on the FS according to the asm.js code as well, because the error code is different if I try to access a nonexistent file (as expected):