Skip to content

Commit 06d5399

Browse files
authored
[FS] Fix resolvePath handling of .. up from fs mountpoint (emscripten-core#23990)
node.parent doesn't actually give us the parent if the node is a FS root. In that case, instead of using `node.parent` we should start over from the beginning. Resolves emscripten-core#23983.
1 parent 0febee8 commit 06d5399

22 files changed

+44
-19
lines changed

src/lib/libfs.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,12 @@ FS.staticInit();
199199

200200
if (parts[i] === '..') {
201201
current_path = PATH.dirname(current_path);
202-
current = current.parent;
202+
if (FS.isRoot(current)) {
203+
path = current_path + '/' + parts.slice(i + 1).join('/');
204+
continue linkloop;
205+
} else {
206+
current = current.parent;
207+
}
203208
continue;
204209
}
205210

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8219
1+
8232
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19929
1+
19993
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8207
1+
8221
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19907
1+
19971
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9217
1+
9231
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
23666
1+
23730
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8165
1+
8177
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19821
1+
19885
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8165
1+
8177

0 commit comments

Comments
 (0)