-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Can't mount root / directory #2040
Comments
We currently by default mount an instance of MEMFS at root as part of the static initialization (staticInit |
Just to revisit this, I'm currently working on using Emscripten to compile LaTeX related tools for Node, the idea being a single cross-platform binary that just works. My first attempt was with ChkTeX, a LaTeX linter here: /~https://github.com/jabooth/chktex.js The problem I have is that the C code I am wrapping may do arbitrary R/W to the filesystem and I want that to be completely transparently mapped into the virtual FS. I ended up doing similar workarounds to svaarala/duktape#355, where I basically manually monkey-patch That's OK for something as small as ChkTeX, but intractable for larger projects. It feels like this is something that must be solvable at the Emscripten Any suggestions for how to solve this transparent FS mapping problem for Node FS targets within the current confides of how Emscripten works @inolen? |
I hope to get some clarification on this issue. Basically memfs is mounted in I'm in the situation where either:
Which way is possible, and how? The documentation shows usages of @kripken mentions technical limitations here #5237 (comment) but what are these technical limitations? So we can try to work it out. Also what about flock and other similar calls? How does emscripten map these to JS calls when using something like nodefs other than providing a binding to C++ like how node-fs-extra package does. |
It might be what @inolen wrote a few comments up (we mount the root already, and there is no unmount support). It's possible no one currently has a good understanding of those technical limitations, as it's pretty stable code and no one has worked on it recently. I'd recommend diving into the code to see. (If it is just that initial mount, it might be possible to add a flag to not do it, and leave all mounting to the user. Maybe worth experimenting with.) |
IIRC the technical limitations revolve around supporting the default set of devices once a different filesystem is mounted at root: /~https://github.com/kripken/emscripten/blob/master/src/library_fs.js#L1257 |
On Windows the MSYS environment has things like |
@juj I'm only interested in the unix (linux) environment. I don't know how emscripten is supposed to react in MSYS? Basically I need to share the "filesystem instance" between what emscripten is exposing to its own module, and my other modules which may not be emscripten compiled. I had written a in-memory FS already in support of this, but then I found that emscripten has a memfs. Anyway that's why I asked about the 2 options in my previous comment: #2040 (comment) |
I found the point where you can make root filesystems pluggable. FS.mount(MEMFS, {}, '/'); This results in a call to this at "program load time":
If the usage of The most easiest solution is to make My current hack right now is to "overlink" the |
This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
I've been running into this issue, too, and wonder if a new, 'Union Filesystem' / unionfs extension to Emscripten might help. In this case, both memfs and the native filesystem could be mounted at '/'. There would, obviously, be opportunity for collisions, but perhaps dealing with these could be moved into separate, maybe-smaller issues? Also, given that this bug was marked Closed due to being stale, might new Github Issues be relevant, here? |
One year later and I ran into the same problem :( |
I can use root directory as a subdirectory in FS tree:
but following code breaks on creating fake /dev/* and /tmp:
All I want is to map real filesystem but some special directories like /dev.
The text was updated successfully, but these errors were encountered: