-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: allow Chtimes with time.Time{} to avoid setting time #32558
Comments
While this would be an improvement, it might have some issues with backwards compatibility. Therefore I would propose, as I did in the related issue to have a new function |
Re @beoran's comment, we confirmed that Chtimes with the zero time right now ends up in 1754 on a Linux file system. So if we adopted the zero time convention then use on older versions would not recognize or reject the zero time and would end up in 1754 instead. |
Given that it looks like #31880 may be declined, we'll probably want to decide this next. It seems like the main question is whether anyone needs this functionality. Does anyone need this? (The backwards compatibility issue can be solved by just waiting a couple releases before starting to use a change.) |
I looked at 150 uses of Coincidentally I found 21 cases that set one or both times to "now". |
I've mentioned a half dozen times to @ianlancetaylor and @griesemer that I thought we already did this and I've tried to find old CLs (that were never submitted?) or old threads on this, but all along it seems I was remembering https://golang.org/pkg/os/#Chown instead which says:
The fact that Chown already does this pattern and I assumed we did the same for Chtimes seems like a vote in favor of this proposal. |
Matching os.Chown's approach for ignoring part of the operation seems like a decent argument for doing the same in os.Chtimes. This seems like a likely accept in the absence of any objections or arguments against it. Leaving open for a week for any final comments. |
No change in consensus. Accepted. |
Change https://golang.org/cl/219638 mentions this issue: |
We are still waiting for responses from the Dragonfly BSD team, and the CL still needs some more work. However, thank you for the patience everyone, and happy holidays! |
Change https://go.dev/cl/498600 mentions this issue: |
Also mention WTF-8 support in the syscall package. For #32558 For #58977 For #59971 Change-Id: Id1627889b5e498add498748d9bfc69fb58030b35 Reviewed-on: https://go-review.googlesource.com/c/go/+/498600 Reviewed-by: Eli Bendersky <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]>
os.Chtimes(f, a, m) sets the access and modification times of the file f to a, m.
The underlying call can usually say "leave this one unset" to set just one of the two.
We could support that by defining that time.Time{} means "don't set this one".
We probably should do that.
Thoughts?
Related to but different from #31880.
The text was updated successfully, but these errors were encountered: