[tz] [PROPOSED] Fix Y2242 bug in tzdb tarball generation

Paul Eggert eggert at cs.ucla.edu
Mon Dec 13 23:12:49 UTC 2021

Use pax format so that ‘make tarballs’ will still work after the
year 2242.  Without this patch, a far-future ‘make tarballs’ would
fail for the same reason the following fails now with GNU tar:

$ touch -d 2242-03-16T12:56:32Z future
$ tar --format=ustar -cf tar future
tar: value 8589934592 out of time_t range 0..8589934591
tar: Exiting with failure status due to previous errors

This patch doesn’t change the tarball format for today’s releases
since we don’t use any features requiring pax format, which means
the tarballs stick to the ustar subset of pax.

Although this issue was exposed by the recent switch to ustar
format, the Y2242 bug has been present since the tzdb project
began, due to historical tar format expiring in 2242 and to POSIX
and GNU coming up with incompatible extensions to deal with this

* Makefile (GNUTARFLAGS): Switch from --format=ustar
to --format=pax --pax-option='delete=atime,delete=ctime'.
* NEWS: Update description of tarball format change.
 Makefile | 3 ++-
 NEWS     | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index d30227a..23dcc14 100644
--- a/Makefile
+++ b/Makefile
@@ -466,7 +466,8 @@ OK_LINE=	'^'$(OK_CHAR)'*$$'
 # Flags to give 'tar' when making a distribution.
 # Try to use flags appropriate for GNU tar.
-GNUTARFLAGS= --format=ustar --numeric-owner --owner=0 --group=0 \
+GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
+  --numeric-owner --owner=0 --group=0 \
   --mode=go+u,go-w --sort=name
 TARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
 		 then echo $(GNUTARFLAGS); \
diff --git a/NEWS b/NEWS
index edb9a1d..1106ef6 100644
--- a/NEWS
+++ b/NEWS
@@ -26,9 +26,12 @@ Unreleased, experimental changes
     instead of GNU format.  Although the formats are almost identical
     for these tarballs, ustar headers' magic fields contain "ustar"
     instead of "ustar ", and their version fields contain "00" instead
-    of " ".  For details about ustar format, please see
+    of " ".  The two formats are planned to diverge more significantly
+    for tzdb releases after 2242-03-16 12:56:31 UTC, when the ustar
+    format becomes obsolete and the tarballs switch to pax format, an
+    extension of ustar.  For details about these formats, please see
     "pax - portable archive interchange", IEEE Std 1003.1-2017,
-    <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_06>.
+    <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13>.
   Changes affecting documentation and commentary

More information about the tz mailing list