-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[WasmFS] Fix absolute path access under NODERAWFS #24733
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
base: main
Are you sure you want to change the base?
Changes from all commits
a6e22e4
f04892c
cb9bb3e
11233e0
2dd31f5
e21bc63
fa12429
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,15 @@ ParsedParent doParseParent(std::string_view path, | |
| size_t& recursions) { | ||
| // Empty paths never exist. | ||
| if (path.empty()) { | ||
| return {-ENOENT}; | ||
| return -ENOENT; | ||
| } | ||
|
|
||
| // For backends that do not require path resolution, WasmFS must not | ||
| // interpret or traverse the path (e.g. via getChild). Once such a | ||
| // backend is reached, the remaining path is forwarded as a whole, | ||
| // and the backend is responsible for resolving it. | ||
| if (!curr->getBackend()->requiresPathResolution()) { | ||
| return {std::make_pair(std::move(curr), path)}; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this going to cause WasmFS to model the underlying file system as completely flat, so that there is a single mount directory directly containing every file ever opened, no matter how deep that file is in the underlying directory structure? If so, is that going to cause problems with reading directory entries?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, this is going to break in such situations as it implicitly assumes that the entire file system behaves like the root backend. Commit e21bc63 changes this to $ tree / -L 2 --dirsfirst
/ (MEMFS)
├── dev
│ ├── null -> SpecialFiles::getNull()
│ ├── random -> SpecialFiles::getRandom()
│ ├── stderr -> SpecialFiles::getStderr()
│ ├── stdin -> SpecialFiles::getStdin()
│ ├── stdout -> SpecialFiles::getStdout()
│ └── urandom -> SpecialFiles::getURandom()
├── tmp
└── host (NODERAWFS)(i.e. the Node filesystem is mounted under
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... actually, that's not a great example, since it already worked without issues (AFAIK). I suspect it would have failed previously with the following layout: $ tree / -L 3 --dirsfirst
/ (NODERAWFS)
└── memory (MEMFS)
├── dev
│ ├── null -> SpecialFiles::getNull()
│ ├── random -> SpecialFiles::getRandom()
│ ├── stderr -> SpecialFiles::getStderr()
│ ├── stdin -> SpecialFiles::getStdin()
│ ├── stdout -> SpecialFiles::getStdout()
│ └── urandom -> SpecialFiles::getURandom()
└── tmpSo, the I suppose that we're missing some test coverage for this. |
||
| } | ||
|
|
||
| // Handle absolute paths. | ||
|
|
@@ -84,7 +92,7 @@ ParsedParent doParseParent(std::string_view path, | |
| // contain a child segment for us to return. The root is its own parent, so we | ||
| // can handle this by returning (root, "."). | ||
| if (path.empty()) { | ||
| return {std::make_pair(std::move(curr), std::string_view("."))}; | ||
| return {std::make_pair(std::move(curr), ".")}; | ||
| } | ||
|
|
||
| while (true) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.