x/sys/unix: Linux: utimensat syscall takes a NULL path, wrapper can't #49699
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?x/sys
package v0.0.0-20211117180635-dee7805ff2e1Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputThe 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?
UtimesNanoAt
, takes a string for the path and does not have a special case to passNULL
when the string is empty.Utimes
goes to/proc
instead of taking advantage of aNULL
pathfutimens
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 addsFUtimesNano
.The text was updated successfully, but these errors were encountered: