]> Cypherpunks repositories - gostls13.git/commit
archive/tar: ignore ChangeTime and AccessTime unless Format is specified
authorJoe Tsai <joetsai@digital-static.net>
Mon, 9 Oct 2017 18:45:43 +0000 (11:45 -0700)
committerJoe Tsai <thebrokentoaster@gmail.com>
Tue, 10 Oct 2017 20:13:27 +0000 (20:13 +0000)
commit577aab0c595825ba113b63f4ef1460e8471c803e
treefe496ab397a43cbd5f5291a089cc65641557328b
parent4cd58c2f2687fc5930a3da2581da09e2e96f69f5
archive/tar: ignore ChangeTime and AccessTime unless Format is specified

CL 59230 changed Writer.WriteHeader to ignore the ChangeTime and AccessTime
fields when considering using the USTAR format when the format is unspecified.
This policy is confusing and leads to unexpected behavior where some files
have ModTime only, while others have ModTime+AccessTime+ChangeTime if the
format became PAX for some unrelated reason (e.g., long pathname).

Change the policy to simply always ignore ChangeTime, AccessTime, and
sub-second time resolutions unless the user explicitly specifies a format.
This is a safe policy change since WriteHeader had no support for the
above features in any Go release.

Support for ChangeTime and AccessTime was added in CL 55570.
Support for sub-second times was added in CL 55552.
Both CLs landed after the latest Go release (i.e., Go1.9), which was
cut from the master branch around August 6th, 2017.

Change-Id: Ib82baa1bf9dd4573ed4f674b7d55d15f733a4843
Reviewed-on: https://go-review.googlesource.com/69296
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/archive/tar/common.go
src/archive/tar/tar_test.go
src/archive/tar/writer.go