-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/sys/unix: No clean way to call utimes(path, NULL)
or friends
#11830
Labels
Milestone
Comments
Seems like an easy enough fix. Want to send a CL? // Utimes blah blah. If tv is nil, blah. Otherwise tv must contain exactly 2 items and blah.
func Utimes(path string, tv []Timeval) (err error) {
if tv == nil {
return utimes(path, nil)
}
switch len(tv) != 2 {
return EINVAL
}
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
} |
Sorry, I'm not very thrilled about CLAs, and have not signed the Google CLA. |
As a workaround
might work. |
CL https://golang.org/cl/12648 mentions this issue. |
This leaves a bunch of the sister calls, and platforms other than linux, still enforcing that logic.
|
CL https://golang.org/cl/12690 mentions this issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The kernel differentiates between setting time to now vs setting it to some timestamp (that may be very very recent past). For example, FUSE sets a separate flag that signals this:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=17637cbaba592076c221dc045ca78422b4af6290
This is normally achieved by passing NULL as times to utimes(2) and friends.
The Go syscall wrappers all explicitly prevent this:
My use case: I wanted to write a FUSE unit test that behaves like touch, and actually causes that flag to be set. Measuring current time and passing it as argument is not good enough.
The text was updated successfully, but these errors were encountered: