Skip to content

Handle AT_SYMLINK_NOFOLLOW in __syscall_faccessat#26500

Open
thiblahute wants to merge 1 commit intoemscripten-core:mainfrom
thiblahute:symlink_nofollow_pr
Open

Handle AT_SYMLINK_NOFOLLOW in __syscall_faccessat#26500
thiblahute wants to merge 1 commit intoemscripten-core:mainfrom
thiblahute:symlink_nofollow_pr

Conversation

@thiblahute
Copy link
Contributor

The assertion in __syscall_faccessat only allowed AT_EACCESS, causing a crash when AT_SYMLINK_NOFOLLOW was passed (e.g. by GLib's g_local_file_query_exists which uses AT_EACCESS | AT_SYMLINK_NOFOLLOW).

Accept AT_SYMLINK_NOFOLLOW and use it to control whether symlinks are followed during the path lookup.

The assertion in __syscall_faccessat only allowed AT_EACCESS, causing
a crash when AT_SYMLINK_NOFOLLOW was passed (e.g. by GLib's
g_local_file_query_exists which uses AT_EACCESS | AT_SYMLINK_NOFOLLOW).

Accept AT_SYMLINK_NOFOLLOW and use it to control whether symlinks are
followed during the path lookup.
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this.

You you perhaps update the test/unistd/access.c test to cover this new code?

path = SYSCALLS.getStr(path);
#if ASSERTIONS
assert(!flags || flags == {{{ cDefs.AT_EACCESS }}});
assert(!flags || !(flags & ~({{{ cDefs.AT_EACCESS }}} | {{{ cDefs.AT_SYMLINK_NOFOLLOW }}})));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe you can remove the !flags || prefix on this condition now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants