You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of #19400 basic NODERAWFS support is present, but we are missing two things at least:
Current support mounts the current directory as the NodeFS root. That works for just writing files to the current real directory, but you can't look up out of it (e.g. you can't read /tmp/something if you began in /usr/home/me). Mounting / instead of . as that PR does might help but it didn't just work when I tried it, but it might be a start.
NODERAWFS doesn't just mount NODEFS but it also apparently forwards in a more direct manner to the underlying Node APIs. I'm not sure of the details there. @sbc100 suggested perhaps implementing NODERAWFS using a replacement syscall layer, which would work for both WasmFS and otherwise. I am not sure of how important that is, though - I'm still going through tests and have not seen a failure yet, but more remain to be tested.
For the first, issue, we just need to go back to mounting /, but then set the initial working directory in WasmFS to correspond to the working directory in the external node file system at startup time, rather than using the WasmFS root as the initial working directory as we normally do.
For the second issue, I share Sam's concerns. For example, if a program expects to use NODERAWFS to communicate via the file system with other programs running on the same system, then things can go very wrong if NODERAWFS is built on top of WasmFS. That's because WasmFS caches a bunch of information (e.g. directory entries and their kinds) and assumes that it has complete control over the file system. External changes that WasmFS doesn't know about can invalidate its assumptions and lead to arbitrary bad things like UB, crashes, and incorrect reads. One option is to add options to WasmFS to make it aggressively avoid caching things, but that increases complexity and code size and isn't very scalable. For example, I doubt we will ever want to add APIs to allow backends to control mtime, ctime, and atime.
Activity
tlively commentedon Jun 5, 2023
For the first, issue, we just need to go back to mounting
/, but then set the initial working directory in WasmFS to correspond to the working directory in the external node file system at startup time, rather than using the WasmFS root as the initial working directory as we normally do.For the second issue, I share Sam's concerns. For example, if a program expects to use NODERAWFS to communicate via the file system with other programs running on the same system, then things can go very wrong if NODERAWFS is built on top of WasmFS. That's because WasmFS caches a bunch of information (e.g. directory entries and their kinds) and assumes that it has complete control over the file system. External changes that WasmFS doesn't know about can invalidate its assumptions and lead to arbitrary bad things like UB, crashes, and incorrect reads. One option is to add options to WasmFS to make it aggressively avoid caching things, but that increases complexity and code size and isn't very scalable. For example, I doubt we will ever want to add APIs to allow backends to control mtime, ctime, and atime.
sbc100 commentedon Jun 5, 2023
Having recently looked at this I think (2) is the best way forward. Re-writing NODERAWFS to be completely independent of both the old FS and WASMFS.
sbc100 commentedon Jun 5, 2023
IIUC there is no need to make
NODERAWFScompatible with the old FS or with WASMFS. Anyone usingNODERAWFSis already opting out of the VFS completely.tlively commentedon Jun 7, 2023
Making NODERAWFS completely separate from WasmFS sounds good to me.
kripken commentedon Jun 7, 2023
Sounds good to me too. It might not be urgent at this time since we have minimal WasmFS support already, but it would be good to get to eventually.