ZIP downloads: the top folder entry has no date (unpacks as 30 Nov 1979) #1133

Closed
opened 2026-11-05 21:57:49 +00:00 by Cordy · 3 comments
Owner

Found in the #1097 ZIP64 gate (v0.6.399, files-bao, 2026-11-05): macOS Archive Utility unpacks the downloaded folder Gate/ with the date 30 November 1979, the zero MS-DOS date. Subfolders (Gate/Leer/) and files carry their real modification times; only the entry for the selected folder itself has none, so zipdl writes it without Modified.

Fix: give the top folder entry the folder's own modification time (from the Stat at the check), or the time of the download if the storage has none; test that every entry in a ZIP has a non-zero time.

Found in the #1097 ZIP64 gate (v0.6.399, files-bao, 2026-11-05): macOS Archive Utility unpacks the downloaded folder `Gate/` with the date 30 November 1979, the zero MS-DOS date. Subfolders (`Gate/Leer/`) and files carry their real modification times; only the entry for the selected folder itself has none, so `zipdl` writes it without `Modified`. Fix: give the top folder entry the folder's own modification time (from the Stat at the check), or the time of the download if the storage has none; test that every entry in a ZIP has a non-zero time.
Author
Owner

Research done (Phase 1, read only, main 666c3d3b): scratch/b7e/backlog/research-1133.md.

Findings:

  • Cause: zipdl.Build takes each selected folder's time from a Stat (plan.go:168, :184, entry :352). On S3 a folder Stat has no time (s3.go:388-396), while List dates folders by their newest content (#76, dirtime.go). So every selected folder on S3 is written without Modified: the top folder, and each folder of a multi-selection. Go then writes DOS date 0 and no 0x5455 extra. Readers show 1979-11-30 (Java, Archive Utility, Go) or "1980-00-00" (unzip).
  • It is not only cosmetic. JDK 9 rejected zero DOS dates, and its bug report names Go's zero date (JDK-8184940).
  • More cases, found with a probe on Go 1.27.1:
    • A file dated before 1980 gets a garbage DOS date: 1970 becomes 2098.
    • Folders below the S3 date scan (5,000 keys) list without a time too.
    • Old tickets from a rolling update carry Mod 0.
  • The public link ZIP and the in-page strong-link ZIP use the same Build and Write, and the page passes the bytes through unchanged (share/zip1097.go:580). One fix covers all three.
  • Market: Nextcloud dates folder entries with the download time, and a pre-1980 time becomes DOS 0. Python clamps pre-1980 times to 1980-01-01 when strict timestamps are off. APPNOTE 4.4.6 says input without a time uses the time of compression.

Recommended: in Build, a folder entry without a time takes the newest time of the entries planned under it. This matches what the Files view shows on S3 and needs no extra request. In Write, any entry still at 0 gets the download time, and anything before 1980 becomes 1980-01-01, so every entry carries DOS fields and 0x5455. Tests: every entry of every ZIP has a time of 1980 or later plus the extended timestamp. Also an S3-like source, multi-selection, 1970 and 0 mtimes, old tickets, and the public and strong link on the s3 fake.

Open questions: Q1 newest content rather than the download time (newest content, download time only for an empty folder), Q2 clamp pre-1980 files (yes). No mockup, no new strings.

Research done (Phase 1, read only, main 666c3d3b): `scratch/b7e/backlog/research-1133.md`. Findings: - Cause: `zipdl.Build` takes each selected folder's time from a Stat (`plan.go:168`, `:184`, entry `:352`). On S3 a folder Stat has no time (`s3.go:388-396`), while List dates folders by their newest content (#76, `dirtime.go`). So every selected folder on S3 is written without `Modified`: the top folder, and each folder of a multi-selection. Go then writes DOS date 0 and no 0x5455 extra. Readers show 1979-11-30 (Java, Archive Utility, Go) or "1980-00-00" (unzip). - It is not only cosmetic. JDK 9 rejected zero DOS dates, and its bug report names Go's zero date (JDK-8184940). - More cases, found with a probe on Go 1.27.1: - A file dated before 1980 gets a garbage DOS date: 1970 becomes 2098. - Folders below the S3 date scan (5,000 keys) list without a time too. - Old tickets from a rolling update carry `Mod 0`. - The public link ZIP and the in-page strong-link ZIP use the same Build and Write, and the page passes the bytes through unchanged (`share/zip1097.go:580`). One fix covers all three. - Market: Nextcloud dates folder entries with the download time, and a pre-1980 time becomes DOS 0. Python clamps pre-1980 times to 1980-01-01 when strict timestamps are off. APPNOTE 4.4.6 says input without a time uses the time of compression. Recommended: in Build, a folder entry without a time takes the newest time of the entries planned under it. This matches what the Files view shows on S3 and needs no extra request. In Write, any entry still at 0 gets the download time, and anything before 1980 becomes 1980-01-01, so every entry carries DOS fields and 0x5455. Tests: every entry of every ZIP has a time of 1980 or later plus the extended timestamp. Also an S3-like source, multi-selection, 1970 and 0 mtimes, old tickets, and the public and strong link on the s3 fake. Open questions: Q1 newest content rather than the download time (newest content, download time only for an empty folder), Q2 clamp pre-1980 files (yes). No mockup, no new strings.
Author
Owner

Decisions (Nikola, 2026-11-05): approved. A folder without a stored time gets the newest time of what is planned under it, an empty one the download time; entries dated before 1980 are written as 1980-01-01; every entry carries the extended timestamp. Covers the app ZIP, the public link ZIP and the in-page strong-link ZIP. Built in batch 2.

**Decisions (Nikola, 2026-11-05):** approved. A folder without a stored time gets the newest time of what is planned under it, an empty one the download time; entries dated before 1980 are written as 1980-01-01; every entry carries the extended timestamp. Covers the app ZIP, the public link ZIP and the in-page strong-link ZIP. Built in batch 2.
Author
Owner

Shipped in v0.6.400 (PR #1136), live on both dogfoods. A ZIP folder entry whose storage keeps no time takes the time of its newest content, else the download time; anything before 1980 is written as 1 January 1980; every entry carries the MS-DOS date and the extended timestamp. Archive Utility check on the S3 dogfood is on the #1005 list.

Shipped in **v0.6.400** (PR #1136), live on both dogfoods. A ZIP folder entry whose storage keeps no time takes the time of its newest content, else the download time; anything before 1980 is written as 1 January 1980; every entry carries the MS-DOS date and the extended timestamp. Archive Utility check on the S3 dogfood is on the #1005 list.
Cordy closed this issue 2026-11-06 12:13:16 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#1133
No description provided.