pkg/blobserver/blobpacked: don't set zip entry DOS modtime on zero time.Time modtime

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
This commit is contained in:
Brad Fitzpatrick 2024-01-15 11:32:02 -08:00
parent 6a119e44a6
commit 1e3963e6b8
2 changed files with 7 additions and 5 deletions

View File

@ -1340,7 +1340,9 @@ func (pk *packer) writeAZip(ctx context.Context, trunc blob.Ref) (err error) {
Name: baseFileName,
Method: zip.Store, // uncompressed
}
fh.SetModTime(pk.fr.ModTime())
if m := pk.fr.ModTime(); !m.IsZero() {
fh.SetModTime(m)
}
fh.SetMode(0644)
fw, err := zw.CreateHeader(fh)
check(err)

View File

@ -491,10 +491,10 @@ func TestReindex(t *testing.T) {
// Specifically check the z: rows.
zrows := []string{
"z:sha224-32505a4f8af2a4f86dda5680caa759ed3c229a3d484ed37b85707a53 | 10521605 sha224-336161c04a4e2ea1ac15dd2fe81820b8a5254c7030d840b61a5deb85 10485760 0 10485760",
"z:sha224-c778d4f89f70ec7068230fe07c172e3107fbad4d9d1664c9cc83fd67 | 5263814 sha224-440ee7ebd58d2adcf48089dfc5ba1ea00d7fb1c887b52874b1fb44a4 5242880 0 5242880",
"z:sha224-d9063688aa83bbc6ec9747222d0499196785f662d0f02ac91e852fa1 | 1121155 sha224-f039af7fe0b27aee76e301a9b3fc92ebbd2ef64b4a4abf6115356441 17825792 16709479 1116313",
"z:sha224-fc99c9411ac39dcdba687a24fef294ba1c4ac731df4ce090a2afea0f | 16771653 sha224-f039af7fe0b27aee76e301a9b3fc92ebbd2ef64b4a4abf6115356441 17825792 0 16709479",
"z:sha224-096fae492d8262946b2326efa93364fe15949b5fa9170691a7be4f79 | 16771653 sha224-f039af7fe0b27aee76e301a9b3fc92ebbd2ef64b4a4abf6115356441 17825792 0 16709479",
"z:sha224-252be95ef0e2d7a20fd6091242bbcf9cde010fe7ec69e03480b59c7f | 1121155 sha224-f039af7fe0b27aee76e301a9b3fc92ebbd2ef64b4a4abf6115356441 17825792 16709479 1116313",
"z:sha224-7e9a2b36e82f06d5e7091f6ba0342e4369e3a0f25b7eb28d130a1895 | 10521605 sha224-336161c04a4e2ea1ac15dd2fe81820b8a5254c7030d840b61a5deb85 10485760 0 10485760",
"z:sha224-df35a92fd7cf4c77c12f4b8d48e55f36ed74da5a7c6929945dc74033 | 5263814 sha224-440ee7ebd58d2adcf48089dfc5ba1ea00d7fb1c887b52874b1fb44a4 5242880 0 5242880",
}
it := pt.sto.meta.Find(zipMetaPrefix, zipMetaPrefixLimit)
i := 0