-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
Please include the following in your bug report:
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.11 (d3432e7a2a6585331c94b041973fb16c9f332ce4)
clang version 21.0.0git (https:/github.com/llvm/llvm-project 0f0079c29da4b4d5bbd43dced1db9ad6c6d11008)
Target: wasm32-unknown-emscripten
Thread model: posix
Consider this example:
/* test.cc */
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
int main(int argc, char** argv) {
char buf[PATH_MAX + 1];
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
if (len > PATH_MAX) {
return 2;
}
printf("self exe: %s", buf);
fflush(stdout);
return 0;
}
% emcc -sEXIT_RUNTIME -sNODERAWFS test.cc && node a.out.js
self exe: /home/trybka/.nvm/versions/node/v22.13.1/bin/node
vs.
% emcc -sEXIT_RUNTIME -sNODERAWFS -sWASMFS test.cc && node a.out.js
self exe:
This is because the "root" of the VFS for NodeRawFS should be /
, but when using WasmFS it is .
(I assume, via
return wasmfs_create_node_backend("."); |
If I change the .
to /
then it works the same in both cases.
Metadata
Metadata
Assignees
Labels
No labels