-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[FS] Fix resolvePath handling of .. up from fs mountpoint #23990
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
Changes from all commits
66fa4f7
9001a57
ee76d83
d37abdb
a5a0733
aa4cfeb
525ef33
ecf6080
0b5b8aa
b361540
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 |
---|---|---|
|
@@ -199,7 +199,12 @@ FS.staticInit(); | |
|
||
if (parts[i] === '..') { | ||
current_path = PATH.dirname(current_path); | ||
current = current.parent; | ||
if (FS.isRoot(current)) { | ||
path = current_path + '/' + parts.slice(i + 1).join('/'); | ||
continue linkloop; | ||
} else { | ||
current = current.parent; | ||
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. If 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. This is not consistent with linux's stat. If a
|
||
} | ||
continue; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8219 | ||
8232 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
19929 | ||
19993 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8207 | ||
8221 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
19907 | ||
19971 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9217 | ||
9231 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
23666 | ||
23730 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8165 | ||
8177 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
19821 | ||
19885 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8165 | ||
8177 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
19821 | ||
19885 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8234 | ||
8245 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20003 | ||
20067 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9255 | ||
9268 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
23780 | ||
23844 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8219 | ||
8232 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
19929 | ||
19993 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
7528 | ||
7542 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
18487 | ||
18551 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
#include <unistd.h> | ||
#include <emscripten.h> | ||
#include "assert.h" | ||
|
||
int main(int argc, char **argv) { | ||
EM_ASM({ | ||
FS.mkdir('/working'); | ||
FS.mkdir('/other'); | ||
FS.mount(NODEFS, { root: '.' }, '/working'); | ||
}); | ||
struct stat statBuf; | ||
assert(stat("/working/../other", &statBuf) == 0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the current node is the root node can we just assume current path is
/
here and dopath = '/' + parts.slice(i + 1).join('/')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because
FS.isRoot()
returnstrue
if it's the root of a mount. So in the test, because we mounted NODEFS at/working
,FS.isRoot()
will return true when processing the..
in the path"/working/../other"
.