vfs: make the reserved root readable through fs - #66140
pipobscure wants to merge 1 commit into
Conversation
|
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.29% 90.28% -0.02%
==========================================
Files 790 791 +1
Lines 272529 272865 +336
Branches 52037 52119 +82
==========================================
+ Hits 246074 246346 +272
- Misses 16908 16978 +70
+ Partials 9547 9541 -6
🚀 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 |
badc074 to
4782615
Compare
4782615 to
a2cd24b
Compare
|
I'm refactoring the reservation of |
a2cd24b to
6eb09bf
Compare
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 the last segment of its path, 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.
Add vfs.vfsBase(), which returns the path of that directory, so that a
program can read it without spelling the path out.
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>
6eb09bf to
1f5af76
Compare
The reserved root
${os.devNull}/vfs, which holds the mount points ofall 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 the last segment of its path, 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.
Add vfs.vfsBase(), which returns the path of that directory, so that a
program can read it without spelling the path out.
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
withFileTypesnowreport 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.txtinto their directory and base name. A recursive listingjoins subdirectories with the host separator rather than
/, whichmixed separators on Windows. realpath() of a mount point no longer
returns it with a trailing separator.