Title: ZipFile tests fail in negative timezone offsets on reproducible build environments · Issue #134261 · python/cpython · GitHub
Open Graph Title: ZipFile tests fail in negative timezone offsets on reproducible build environments · Issue #134261 · python/cpython
X Title: ZipFile tests fail in negative timezone offsets on reproducible build environments · Issue #134261 · python/cpython
Description: Bug report Bug description: Background Relates to #73894 Reproducibility for ZipFile introduced in #91279 See https://reproducible-builds.org/ and https://reproducible-builds.org/docs/buy-in/ for why this is a good thing to have in gener...
Open Graph Description: Bug report Bug description: Background Relates to #73894 Reproducibility for ZipFile introduced in #91279 See https://reproducible-builds.org/ and https://reproducible-builds.org/docs/buy-in/ for w...
X Description: Bug report Bug description: Background Relates to #73894 Reproducibility for ZipFile introduced in #91279 See https://reproducible-builds.org/ and https://reproducible-builds.org/docs/buy-in/ for w...
Opengraph URL: https://github.com/python/cpython/issues/134261
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ZipFile tests fail in negative timezone offsets on reproducible build environments","articleBody":"# Bug report\n\n### Bug description:\n\n#### Background\n - Relates to https://github.com/python/cpython/issues/73894\n - Reproducibility for ZipFile introduced in https://github.com/python/cpython/issues/91279\n - See https://reproducible-builds.org/ and https://reproducible-builds.org/docs/buy-in/ for why this is a good thing to have in general, and https://reproducible-builds.org/docs/source-date-epoch for basic information on `SOURCE_DATE_EPOCH` specifically.\n\n#### Bug\nIf building on a reproducible environment such as NixOS, and your local timezone has a negative UTC offset, a large number of the ZipFile tests fail due to a underflow of the DOS date value:\n - Zips by default store file timestamps as a DOS date and a DOS time, They are unsigned and 16-bits wide. \n - NixOS sets environment variable `SOURCE_DATE_EPOCH` to `315532800` (1980-01-01 00:00:00 UTC) to specifically support programs and standards assuming DOS time (https://github.com/NixOS/nixpkgs/pull/89794), of which zip is one.\n - In recent ZipFile updates, `SOURCE_DATE_EPOCH` is read from if it exists. If it exists, it's not taken as UTC and is instead converted to the system's local time:\n - https://github.com/python/cpython/blob/8d490b368766ee7b28d2ccf47704b1d4b5f1ea23/Lib/zipfile/__init__.py#L625-L628\n - If your local time has a negative UTC offset, this ends up subtracting from the minimum possible DOS date value, which underflows to what would be a negative DOS date.\n - In tests, `ValueError` is raised anytime a file is written to a ZipFile, because the DOS date under reproducible systems is not in the range `0 \u003c= date \u003c= 65535`.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-134264\n* gh-150137\n* gh-150138\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/ctrlaltf2","@type":"Person","name":"ctrlaltf2"},"datePublished":"2025-05-19T18:06:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/134261/cpython/issues/134261"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ad4a5b77-92ed-7e98-8181-d06aba6546ce |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C62:3A401E:5996D7:7918E7:6A52995C |
| html-safe-nonce | 3bd52c842c14ef12113d3eb6956493eb938828f34d0f5ef8d92f677e0b444283 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzYyOjNBNDAxRTo1OTk2RDc6NzkxOEU3OjZBNTI5OTVDIiwidmlzaXRvcl9pZCI6IjIxMDI3OTUzMDEwNDc5MzMyNzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6631e3058e9a5c8f9177b98808b4fb9a09320a595c6567c746a1286b20fa5831 |
| hovercard-subject-tag | issue:3074636106 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/134261/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a1a8e43f3885b92e3417f67bd39a6ff708718558d8e9db387fbb12d85f75856d/python/cpython/issues/134261 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a1a8e43f3885b92e3417f67bd39a6ff708718558d8e9db387fbb12d85f75856d/python/cpython/issues/134261 |
| og:image:alt | Bug report Bug description: Background Relates to #73894 Reproducibility for ZipFile introduced in #91279 See https://reproducible-builds.org/ and https://reproducible-builds.org/docs/buy-in/ for w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ctrlaltf2 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width