-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Make WASMFS FS.createPath match the FS version behavior on EEXIST #23603
Merged
kripken
merged 4 commits into
emscripten-core:main
from
JoeOsborn:fix-wasmfs-createpath
Feb 10, 2025
+84
−2
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
af57bd6
Make WASMFS FS.createPath match the FS version behavior on EEXIST
JoeOsborn 1b9db86
Make FS.createPath only ignore EEXIST errors, not other errors
JoeOsborn 3e2760e
reduce and document overlapped file package test
JoeOsborn f07e4ac
Add createPath test
JoeOsborn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2025 The Emscripten Authors. All rights reserved. | ||
// Emscripten is available under two separate licenses, the MIT license and the | ||
// University of Illinois/NCSA Open Source License. Both these licenses can be | ||
// found in the LICENSE file. | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <assert.h> | ||
|
||
#include <emscripten.h> | ||
|
||
void error2() { | ||
printf("fail2\n"); | ||
} | ||
|
||
void load2() { | ||
char buffer[10]; | ||
memset(buffer, 0, 10); | ||
FILE *f = fopen("/target/file1.txt", "r"); | ||
assert(f); | ||
fread(buffer, 1, 5, f); | ||
fclose(f); | ||
assert(strcmp(buffer, "first") == 0); | ||
|
||
memset(buffer, 0, 10); | ||
f = fopen("/target/file2.txt", "r"); | ||
assert(f); | ||
fread(buffer, 1, 6, f); | ||
fclose(f); | ||
assert(strcmp(buffer, "second") == 0); | ||
exit(0); | ||
} | ||
|
||
void load1() { | ||
emscripten_async_load_script("script2.js", load2, error2); | ||
} | ||
|
||
void error1() { | ||
printf("fail1\n"); | ||
} | ||
|
||
int main() { | ||
emscripten_async_load_script("script1.js", load1, error1); | ||
return 99; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm actually little confused by this fix. I tried running
wasmfs.test_fs_js_api
and it passed both with or without this change.Looking into it it looks the repeated calls to
FS.mkdir
here always seem to succeed. I modified the code here to add some extra debugging and I see:I'm a little confused how you were hitting an error here? I must be missing something.
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.
Hmm even stranger, browser.test_emscripten_overlapped_package seem to pass both before and after this test.
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.
Ah I wasn't running
browser.test_emscripten_overlapped_package_wasmfs
.. that one does fail.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.
I found the issue with test_fs_js_api: #23645