diff --git a/internal/chart/v3/util/save.go b/internal/chart/v3/util/save.go index 49d93bf40..606e0b6b0 100644 --- a/internal/chart/v3/util/save.go +++ b/internal/chart/v3/util/save.go @@ -233,6 +233,7 @@ func writeToTar(out *tar.Writer, name string, body []byte) error { Mode: 0644, Size: int64(len(body)), ModTime: time.Now(), + Format: tar.FormatPAX, } if err := out.WriteHeader(h); err != nil { return err diff --git a/internal/chart/v3/util/save_test.go b/internal/chart/v3/util/save_test.go index 9b1b14a4c..91a7ac7dc 100644 --- a/internal/chart/v3/util/save_test.go +++ b/internal/chart/v3/util/save_test.go @@ -137,10 +137,7 @@ func Indent(n int, text string) string { } func TestSavePreservesTimestamps(t *testing.T) { - // Test executes so quickly that if we don't subtract a second, the - // check will fail because `initialCreateTime` will be identical to the - // written timestamp for the files. - initialCreateTime := time.Now().Add(-1 * time.Second) + initialCreateTime := time.Now() tmp := t.TempDir() diff --git a/pkg/chart/v2/util/save.go b/pkg/chart/v2/util/save.go index 69a98924c..ca363279f 100644 --- a/pkg/chart/v2/util/save.go +++ b/pkg/chart/v2/util/save.go @@ -245,6 +245,7 @@ func writeToTar(out *tar.Writer, name string, body []byte) error { Mode: 0644, Size: int64(len(body)), ModTime: time.Now(), + Format: tar.FormatPAX, } if err := out.WriteHeader(h); err != nil { return err diff --git a/pkg/chart/v2/util/save_test.go b/pkg/chart/v2/util/save_test.go index ef822a82a..c88741972 100644 --- a/pkg/chart/v2/util/save_test.go +++ b/pkg/chart/v2/util/save_test.go @@ -140,10 +140,7 @@ func Indent(n int, text string) string { } func TestSavePreservesTimestamps(t *testing.T) { - // Test executes so quickly that if we don't subtract a second, the - // check will fail because `initialCreateTime` will be identical to the - // written timestamp for the files. - initialCreateTime := time.Now().Add(-1 * time.Second) + initialCreateTime := time.Now() tmp := t.TempDir()