vfs: make the reserved root readable through fs - #66140
pipobscure wants to merge 1 commit into
Conversation
The reserved root `${os.devNull}/vfs`, which holds the mount points of
all virtual file systems, could not be read: fs calls on it fell through
to the real file system, so nothing could list what was mounted.
While any file system is mounted, serve the root as a read-only
directory. It lists every mount point by its layer id, a recursive
listing descends into each mounted file system, and paths under it that
no mount serves report ENOENT. Creating, removing or changing entries in
it fails with EROFS. When nothing is mounted it does not exist, as
before.
A mount point cannot be removed or renamed, nor replaced by a rename:
rmdir() and rename() fail with EBUSY, and a recursive rm() empties the
file system and then fails the same way. Before, rmdir() of an empty
mount point reported success without doing anything.
The callback and promise forms of readdir() with `withFileTypes` now
report each Dirent's parentPath as a host path, as readdirSync() did,
instead of the provider-relative one, and split recursive names such as
`dir/file.txt` into their directory and base name. A recursive listing
joins subdirectories with the host separator rather than `/`, which
mixed separators on Windows. realpath() of a mount point no longer
returns it with a trailing separator.
Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
|
The docs for
Presumably that should be updated? |
The reason I left it because the feature is experimental and we're not constructing a mount-paths, but rather the well-known root of all vfs-mounts. Though that's debatable. I'll go with whatever you say, but am happy to remove it if this rationale seems too flimsy. The question that brought up for me though is whether we want a |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66140 +/- ##
========================================
Coverage 90.28% 90.28%
========================================
Files 790 791 +1
Lines 271982 272308 +326
Branches 51915 52009 +94
========================================
+ Hits 245546 245860 +314
+ Misses 16947 16932 -15
- Partials 9489 9516 +27
🚀 New features to boost your workflow:
|
|
Mostly I just don't like it when docs seem to contradict themselves; I always assume I'm misreading something. (Right now one part of the docs appears to be saying "don't assume things are under devnull" and another says to enumerate devnull.) Adding |
The reserved root
${os.devNull}/vfs, which holds the mount points of all virtual file systems, could not be read: fs calls on it fell through to the real file system, so nothing could list what was mounted.While any file system is mounted, serve the root as a read-only directory. It lists every mount point by its layer id, a recursive listing descends into each mounted file system, and paths under it that no mount serves report ENOENT. Creating, removing or changing entries in it fails with EROFS. When nothing is mounted it does not exist, as before.
A mount point cannot be removed or renamed, nor replaced by a rename: rmdir() and rename() fail with EBUSY, and a recursive rm() empties the file system and then fails the same way. Before, rmdir() of an empty mount point reported success without doing anything.
The callback and promise forms of readdir() with
withFileTypesnow report each Dirent's parentPath as a host path, as readdirSync() did, instead of the provider-relative one, and split recursive names such asdir/file.txtinto their directory and base name. A recursive listing joins subdirectories with the host separator rather than/, which mixed separators on Windows. realpath() of a mount point no longer returns it with a trailing separator.