-
Notifications
You must be signed in to change notification settings - Fork 271
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
Emulates AT_SYMLINK_NOFOLLOW instead of sometimes implementing it #1588
Conversation
futimes `AT_SYMLINK_NOFOLLOW` isn't universally supported. Before, we attempted to support it, but it was a bit hairy. It is better to take the hit of opening the file in the case we need to *not* follow symlinks than deal with something not very portable by default. Signed-off-by: Adrian Cole <adrian@tetrate.io>
@@ -1456,7 +1456,16 @@ func pathFilestatSetTimesFn(_ context.Context, mod api.Module, params []uint64) | |||
} | |||
|
|||
symlinkFollow := flags&wasip1.LOOKUP_SYMLINK_FOLLOW != 0 |
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.
the flag is the opposite of the POSIX one in wasip1, presumably to avoid accidentally setting it by default.
) | ||
|
||
//go:noescape | ||
//go:linkname utimensat syscall.utimensat | ||
func utimensat(dirfd int, path string, times *[2]syscall.Timespec, flags int) error | ||
|
||
func utimens(path string, times *[2]syscall.Timespec, symlinkFollow bool) error { | ||
func utimens(path string, times *[2]syscall.Timespec) error { |
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.
a later PR will switch this to os.Chtimes which is basically the same logic (once we remove the special OMIT and NOW constants)
futimes
AT_SYMLINK_NOFOLLOW
isn't universally supported. Before, we attempted to support it, but it was a bit hairy. It is better to take the hit of opening the file in the case we need to not follow symlinks than deal with something not very portable by default.