mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
A single executable application built with "useVfs" mounted the VFS serving its "assets" in the main thread only, at a mount point numbered in mount order, so a worker started from a script among the assets could not load it. On Windows this failed as an invalid package.json at \.\nul\package.json, because paths under the NUL device open it. "useVfs" is the --vfs-load of a single executable application: its "assets" or its "vfsArchive" archive are the source, and its "main" is the entry point. Mount it at layer 0, the mount point reserved for the --vfs-load source, whichever provider serves it, and mount it in workers too, as was already done for an archive. Other mounts are numbered from 1, as everywhere else. To keep layer 0 free, reject --vfs-load in every single executable application rather than only in one built with "vfsArchive": its entry point is fixed, and resolving modules against its files is what "useVfs" already does. --build-sea refuses it in "execArgv", and the executable at startup when it comes from --node-options or from the execArgv of a worker. A worker started from a path into a VFS that is not mounted in it, such as one mounted with vfs.mount() in its parent, now fails with ERR_VFS_NOT_MOUNTED. Fixes: https://github.com/nodejs/node/issues/67223 Assisted-by: a coding agent Signed-off-by: Manjeet Singh <024manjeetsingh@gmail.com> PR-URL: https://github.com/nodejs/node/pull/67239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Philipp Dunkel <pip@pipobscure.com>