-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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
archive/tar: Writer does not support sub-second time resolution #11171
Comments
This looks like it is caused by archive/tar's inability to write subsecond resolution mtimes, or to write atimes or ctimes at all. All of these would have to go in a PAX header. I can attempt a patch, if no one else is already working on archive/tar. |
CL https://golang.org/cl/14164 mentions this issue. |
I recommend changing the title: "archive/tar: writer does not support sub-second resolution" |
\cc @jstarks |
@dsnet - If you are not working on this, may I take it ? |
I actually already implemented it. A lot of the changes I'm submitting to tar is just me copying them from my previous work If you want to review it, that'd be great, I can send it to you. |
Ah I see. I saw that you had done "implement specialized logic for PAX format". But didn't know that you have all the changes in the pipeline. I don't think I am expert enough to review a change 😆 . But if you have some small work lying somewhere (for tar), I would be happy to tackle that. 😄 |
Change https://golang.org/cl/55552 mentions this issue: |
Change https://golang.org/cl/59230 mentions this issue: |
Nearly every Header obtained from FileInfoHeader via the FS has timestamps with sub-second resolution and the AccessTime and ChangeTime fields populated. This forces the PAX format to almost always be used, which has the following problems: * PAX is still not as widely supported compared to USTAR * The PAX headers will occupy at minimum 1KiB for every entry The old behavior of tar Writer had no support for sub-second resolution nor any support for AccessTime or ChangeTime, so had neither problem. Instead the Writer would just truncate sub-second information and ignore the AccessTime and ChangeTime fields. In this CL, we preserve the behavior such that the *default* behavior would output a USTAR header for most cases by truncating sub-second time measurements and ignoring AccessTime and ChangeTime. To use either of the features, users will need to explicitly specify that the format is PAX or GNU. The exact policy chosen is this: * USTAR and GNU may still be chosen even if sub-second measurements are present; they simply truncate the timestamp to the nearest second. As before, PAX uses sub-second resolutions. * If the Format is unspecified, then WriteHeader ignores AccessTime and ChangeTime when using the USTAR format. This ensures that USTAR may still be chosen for a vast majority of file entries obtained through FileInfoHeader. Updates #11171 Updates #17876 Change-Id: Icc5274d4245922924498fd79b8d3ae94d5717271 Reviewed-on: https://go-review.googlesource.com/59230 Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
ModTime, AccessTime and ChangeTime changed after packing/unpacking.
go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: