-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
What version of Go are you using (go version)?
x/sys package v0.0.0-20211117180635-dee7805ff2e1
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
go env Output
The version of Golang we use at Google (I believe this is not public information, please correct me if I'm wrong and I'll share
go env)
What did you do?
I opened the documentation of sys/unix and also read its source code.
What did you expect to see?
I expected to be able to do the equivalent to the futimens glibc function.
This could have been its own function. Alternatively the wrapper of utimensat could have given empty strings the special meaning that NULL pointers have for the syscall.
(On Linux, in the glibc, futimens is implemented on top of utimensat by passing a NULL pointer as path. This is described in the NOTES section of the manpage.)
I also expected to see Futimes implemented in a way that did not go through /proc
What did you see instead?
- The wrapper of utimensat, named
UtimesNanoAt, takes a string for the path and does not have a special case to passNULLwhen the string is empty. - The wrapper of
Utimesgoes to/procinstead of taking advantage of aNULLpath - There is no equivalent for
futimens
Please let me know if you'd like me to contribute a fix. Unless someone suggest another approach, I offer to send a PR that leaves UtimesNanoAt unchanged and adds FUtimesNano.