Skip to content

fix(base): ship the IANA timezone database in every box - #804

Merged
norrietaylor merged 2 commits into
mainfrom
fix/tzdata-in-base
Oct 4, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
fix/tzdata-in-base

Conversation

@norrietaylor

@norrietaylor norrietaylor commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Problem

Boxes have no timezone database. /usr/share/zoneinfo does not exist, so:

  • TZ=America/Vancouver date silently prints UTC, labelled America.
  • Python's zoneinfo.ZoneInfo("America/Vancouver") raises ZoneInfoNotFoundError.
  • No package provides zone data, so tzdata is not found by a package search either.

Change

  • New packages/tzdata. It fetches the IANA tzdata2026e release, pinned by sha256, and compiles it with glibc's zic (-b slim) into usr/share/zoneinfo. It compiles the same sources that upstream's Makefile builds by default: the primary regions plus etcetera and backward. It also installs iso3166.tab, zone.tab and zone1970.tab, the tables that tzselect and Python's zoneinfo read. The license is LicenseRef-Public-Domain, the repo's existing convention for public-domain data.
    • The build deps are bash-bootstrap, coreutils and glibc (for zic), not base. base now carries tzdata at runtime, so building tzdata against base would create a cycle.
    • The source URL points at data.iana.org directly. The minimal-staging-archives mirror does not carry a tzdata tarball yet. If you prefer the mirror, upload tzdata2026e.tar.gz (sha256 b26882805f26aac59d5b222978e6580484b834ccdc98be89df2f05a6dc53a652) and swap the URL.
  • base runtime_deps gains tzdata, so every box resolves TZ=Area/City and Python's zoneinfo works without extra packages.
  • tcl configure gains --with-tzdata. Tcl's configure skips installing its bundled zone data when it finds /usr/share/zoneinfo/UTC, which base now provides. Without the flag, the tzdata output glob (usr/lib/tcl*/tzdata/**) matched nothing and the build failed on both arches. The flag keeps tcl's outputs unchanged.
  • /etc/localtime stays unset, so the default is still UTC. Users opt in with TZ.
  • Tests:
    • A tzdata standalone test checks that /usr/share/zoneinfo/UTC exists, that TZ=America/Vancouver date +%Z prints PST or PDT, and that Paris is UTC+1 at the epoch.
    • A python standalone test (test_deps = [base]) checks that zoneinfo.ZoneInfo('Europe/Paris') resolves.

Size impact

The compiled tree is 600 files totalling 379 KiB of data (du --apparent-size). On a 4 KiB-block filesystem it allocates about 2.5 MiB, because most zone files are around 1 KiB. Backward-compatibility names such as US/Pacific are hard links to the canonical zone, not copies. The fetched tarball is 471 KiB.

For scale, a default session's /usr measures about 508 MiB with du --apparent-size on the same VM. tzdata adds under 0.1% of that by apparent size, or about 0.5% allocated.

Rebuild cost: base is a build dep of about 450 packages, so this change re-keys all of them.

Test plan

Run on an arm64 Minimal VM (macOS host), in sessions synced from this branch:

  • min check --packages tzdata,base,python: every check passes. After the build, the output checks (enumerate bins, output types valid, missing runtime_deps) also pass for tzdata.
  • min package patched-build tzdata and min package patched-build base succeed.
  • Before the change (session on main): TZ=America/Vancouver date +%Z prints America, and /usr/share/zoneinfo is missing.
  • After the change (session on this branch): TZ=America/Vancouver date +%Z prints PDT, TZ=Europe/Paris date -d @0 +%H prints 01, and /usr/share/zoneinfo/UTC exists.
  • With python added: zoneinfo.ZoneInfo("Europe/Paris") resolves (UTC offset 2:00:00 on 2026-07-01), and zoneinfo.available_timezones() returns 597 zones.
  • Not run locally: the standalone tests blocks themselves (there's no in-session test runner), amd64, and a two-build byte-reproducibility diff. zic output has no timestamps, but CI is the first run of all three.
  • tcl with --with-tzdata: not built locally; CI's minimal build passes.

Refs gominimal/inbox#844

Add a tzdata package that compiles the IANA tzdata release with zic into
usr/share/zoneinfo, and add it to base's runtime_deps. Without it,
TZ=Area/City silently falls back to UTC and Python's zoneinfo cannot
resolve any zone. /etc/localtime stays unset, so the default remains UTC.

Refs gominimal/inbox#844
@norrietaylor
norrietaylor requested a review from a team as a code owner October 4, 2026 04:16
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: gominimal/pkgs/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: b658ad51-d553-4795-a9d6-f1cd7a5f87ef
📥 Commits

Reviewing files that changed from the base of the PR and between c583978 and f99bdf8.

📒 Files selected for processing (5)
  • packages/base/build.ncl
  • packages/python/build.ncl
  • packages/tcl/build.sh
  • packages/tzdata/build.ncl
  • packages/tzdata/build.sh

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

Adds a tzdata package that builds zoneinfo data. The base package depends on it. Tcl configuration enables tzdata, and a Python smoke test constructs a ZoneInfo for Europe/Paris.

Changes

Timezone data support

Layer / File(s) Summary
Build and validate tzdata
packages/tzdata/build.ncl, packages/tzdata/build.sh
Adds a pinned tzdata 2026e build specification. The build compiles zoneinfo files and includes checks for UTC, Vancouver, and Paris time data.
Connect timezone data to packages
packages/base/build.ncl, packages/tcl/build.sh, packages/python/build.ncl
Adds tzdata to base runtime dependencies, passes --with-tzdata to Tcl configuration, and adds a Python smoke test that constructs ZoneInfo('Europe/Paris').

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: twitchyliquid64

Merge Risk: ⚪ Minimal · up to f99bd

The timezone-data change is mergeable after normal checks; the remaining test suggestion does not establish a material risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: shipping the IANA time-zone database in every box by adding it to base.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@CLAassistant

CLAassistant commented Oct 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Tcl's configure autodetects /usr/share/zoneinfo and skips installing its
own zone data when it finds one. With tzdata in base, the tzdata output
glob matched nothing and the build failed. Pass --with-tzdata so the
output stays populated regardless of the build environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AkfcXf7j7iRngh4dKjye3f
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
Merged via the queue into main with commit bd62e6e Oct 4, 2026
11 checks passed
@norrietaylor
norrietaylor deleted the fix/tzdata-in-base branch October 4, 2026 19:21
norrietaylor added a commit to gominimal/minimal that referenced this pull request Oct 4, 2026
gominimal/pkgs#804 adds tzdata to base, so boxes resolve TZ=Area/City

and Python's zoneinfo finds its zones.
yermakoffivan pushed a commit to yermakoffivan/minimal that referenced this pull request Oct 5, 2026
…minimal#1962)

* build: bump the pkgs locked_commit for the guest kernel's conntrack marks

Picks up gominimal/pkgs#803, which enables CONFIG_NF_CONNTRACK_MARK in the
virtio-linux guest kernel. The guest classifier table's ct mark rule needs it
(T75, gominimal#1886). One pkgs commit; the only file it changes is
packages/virtio-linux/build.sh.

* build: bump the pkgs locked_commit for the timezone database in base

gominimal/pkgs#804 adds tzdata to base, so boxes resolve TZ=Area/City

and Python's zoneinfo finds its zones.
evanspearman pushed a commit to evanspearman/pkgs that referenced this pull request Oct 20, 2026
…inimal#815)

pkgmgr flagged tzdata (new in gominimal#804) as a MONITORING GAP: no source_provenance
and no curated CPE, so its 0/0/0 was indistinguishable from "cannot check".
A CPE cannot fix it: NVD's CPE dictionary has no entry for the tz database
under any vendor, and every tz-ish CPE in our vulndb is a false friend
(SonicWall TZ firewalls, moment-timezone, ...).

eggert/tz is the tz project's own repository; its tags match our version
scheme (2026e). The download stays on data.iana.org; provenance only drives
advisory and version lookups.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants