-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Undefine SYS_access so we only need __syscall_faccessat #16296
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
Conversation
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.
Nice!
After #16296 it is simple to get that test passing: * Add FS.chmod * Fix FS.mkdir which did not receive or sent the mode param to wasm * Test tweaks
I think this PR broke #include <unistd.h>
#include <stdio.h>
int main() {
printf("%d\n", access("C:/existingfile", F_OK));
return 0;
} # Make a new file named existingfile in C:/
$ type nul > C:/existingfile
# Ensure C:/existingfile does really exist
$ IF EXIST "C:/existingfile" (echo 1) ELSE (echo 0)
1
# faccessat(2) should ignore dirfd when pathname is absolute
# (i.e. it should check the presence of C:/existingfile and not ./C:/existingfile)
$ emcc test.c -o test.js -sNODERAWFS -sEXIT_RUNTIME
# This should print 0, indicating that C:/existingfile does exists
$ node test.js
-1
$ rem C:/existingfile
# This should always print -1, since we deleted C:/existingfile above
$ node test.js
-1 Absolute POSIX paths are already handled here: emscripten/src/library_syscall.js Lines 24 to 26 in acbf9e6
So, it needs something similar to Node's Windows variant of Perhaps we can just call that utility instead when |
Interesting.. I think maybe we need to create a |
Also, use arrow functions in `library_path.js` to save a little on code size. As a followup we can have NODERAWFS replace the isAbs function (most likely calling out to node's `path.isAbsolute`). See #16296
|
Because then NODERAWRS under windows could override this method such that |
Also, use arrow functions in `library_path.js` to save a little on code size. As a followup we can have NODERAWFS replace the isAbs function (most likely calling out to node's `path.isAbsolute`). See #16296
But why was such an overriding necessary after this PR (which does not modify JS code in a significant way AFAICT)? |
This change forces more code to through |
Got it, thanks @sbc100 ! |
Ensures that absolute paths are handled correctly on Windows as well. Using these helpers should be safe, since binaries linked with -sNODERAWFS can only be used on Node.js, see: emscripten/src/library_noderawfs.js Line 28 in e98554f throw new Error("NODERAWFS is currently only supported on Node.js environment.") Context: #16296 Resolves: #17360. Resolves: #17819. Supersedes: #17821.
This way we just need to define one syscall instead of two. (Musl will
call the proper syscall based on what it sees is defined.)