Skip to content

[WasmFS] Fix absolute path access under NODERAWFS] #24833

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/lib/wasmfs/backends/noderawfs_root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace wasmfs {

backend_t wasmfs_create_root_dir(void) {
return wasmfs_create_node_backend(".");
return wasmfs_create_node_backend("/");
}

} // namespace wasmfs
12 changes: 9 additions & 3 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -10447,16 +10447,22 @@ def test_noderawfs_disables_embedding(self):
err = self.expect_fail(base + ['--embed-file', 'somefile'])
self.assertContained(expected, err)

@also_with_wasmfs
def test_noderawfs_access_abspath(self):
create_file('foo', 'bar')
create_file('access.c', r'''
#include <stdio.h>
#include <assert.h>
#include <unistd.h>

int main(int argc, char** argv) {
return access(argv[1], F_OK);
printf("testing access to %s\n", argv[1]);
int rtn = access(argv[1], F_OK);
assert(rtn == 0);
return 0;
}
''')
self.run_process([EMCC, 'access.c', '-sNODERAWFS'])
self.run_js('a.out.js', args=[os.path.abspath('foo')])
self.do_runf('access.c', cflags=['-sNODERAWFS'], args=[os.path.abspath('foo')])

def test_noderawfs_readfile_prerun(self):
create_file('foo', 'bar')
Expand Down
Loading