Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/time Change to code and documentation from 2021a ->...
details: https://anonhg.NetBSD.org/src/rev/9b66182d0ea6
branches: trunk
changeset: 989978:9b66182d0ea6
user: christos <christos%NetBSD.org@localhost>
date: Fri Oct 22 14:26:04 2021 +0000
description:
Change to code and documentation from 2021a -> 2021e
Release 2021e - 2021-10-21 18:41:00 -0700
Changes to code
none
Release 2021d - 2021-10-15 13:48:18 -0700
Changes to code
'zic -r' now uses "-00" time zone abbreviations for intervals
with UT offsets that are unspecified due to -r truncation.
This implements a change in draft Internet RFC 8536bis.
Release 2021c - 2021-10-01 14:21:49 -0700
Changes to code
Fix a bug in 'zic -b fat' that caused old timestamps to be
mishandled in 32-bit-only readers (problem reported by Daniel
Fischer).
Changes to documentation
Distribute the SECURITY file (problem reported by Andreas Radke).
Release 2021b - 2021-09-24 16:23:00 -0700
Changes to maintenance procedure
The new file SECURITY covers how to report security-related bugs.
Several backward-compatibility links have been moved to the
'backward' file. These links, which range from Africa/Addis_Ababa
to Pacific/Saipan, are only for compatibility with now-obsolete
guidelines suggesting an entry for every ISO 3166 code.
The intercontinental convenience links Asia/Istanbul and
Europe/Nicosia have also been moved to 'backward'.
Changes to code
zic now creates each output file or link atomically,
possibly by creating a temporary file and then renaming it.
This avoids races where a TZ setting would temporarily stop
working while zic was installing a replacement file or link.
zic -L no longer omits the POSIX TZ string in its output.
Starting with 2020a, zic -L truncated its output according to the
"Expires" directive or "#expires" comment in the leapseconds file.
The resulting TZif files omitted daylight saving transitions after
the leap second table expired, which led to far less-accurate
predictions of times after the expiry. Although future timestamps
cannot be converted accurately in the presence of leap seconds, it
is more accurate to convert near-future timestamps with a few
seconds error than with an hour error, so zic -L no longer
truncates output in this way.
Instead, when zic -L is given the "Expires" directive, it now
outputs the expiration by appending a no-change entry to the leap
second table. Although this should work well with most TZif
readers, it does not conform to Internet RFC 8536 and some pickier
clients (including tzdb 2017c through 2021a) reject it, so
"Expires" directives are currently disabled by default. To enable
them, set the EXPIRES_LINE Makefile variable. If a TZif file uses
this new feature it is marked with a new TZif version number 4,
a format intended to be documented in a successor to RFC 8536.
zic -L LEAPFILE -r @LO no longer generates an invalid TZif file
that omits leap second information for the range LO..B when LO
falls between two leap seconds A and B. Instead, it generates a
TZif version 4 file that represents the previously-missing
information.
The TZif reader now allows the leap second table to begin with a
correction other than -1 or +1, and to contain adjacent
transitions with equal corrections. This supports TZif version 4.
The TZif reader now lets leap seconds occur less than 28 days
apart. This supports possible future TZif extensions.
Fix bug that caused 'localtime' etc. to crash when TZ was
set to a all-year DST string like "EST5EDT4,0/0,J365/25" that does
not conform to POSIX but does conform to Internet RFC 8536.
Fix another bug that caused 'localtime' etc. to crash when TZ was
set to a POSIX-conforming but unusual TZ string like
"EST5EDT4,0/0,J365/0", where almost all the year is DST.
Fix yet another bug that caused 'localtime' etc. to mishandle slim
TZif files containing leap seconds after the last explicit
transition in the table, or when handling far-future timestamps
in slim TZif files lacking leap seconds.
Fix localtime misbehavior involving positive leap seconds.
This change affects only behavior for "right" system time,
which contains leap seconds, and only if the UT offset is
not a multiple of 60 seconds when a positive leap second occurs.
(No such timezone exists in tzdb, luckily.) Without the fix,
the timestamp was ambiguous during a positive leap second.
With the fix, any seconds occurring after a positive leap second
and within the same localtime minute are counted through 60, not
through 59; their UT offset (tm_gmtoff) is the same as before.
Here is how the fix affects timestamps in a timezone with UT
offset +01:23:45 (5025 seconds) and with a positive leap second at
1972-06-30 23:59:60 UTC (78796800):
time_t without the fix with the fix
78796800 1972-07-01 01:23:45 1972-07-01 01:23:45 (leap second)
78796801 1972-07-01 01:23:45 1972-07-01 01:23:46
...
78796815 1972-07-01 01:23:59 1972-07-01 01:23:60
78796816 1972-07-01 01:24:00 1972-07-01 01:24:00
Fix an unlikely bug that caused 'localtime' etc. to misbehave if
civil time changes a few seconds before time_t wraps around, when
leap seconds are enabled.
Fix bug in zic -r; in some cases, the dummy time type after the
last time transition disagreed with the TZ string, contrary to
Internet RFC 8563 section 3.3.
Fix a bug with 'zic -r @X' when X is a negative leap second that
has a nonnegative correction. Without the fix, the output file
was truncated so that X appeared to be a positive leap second.
Fix a similar, even-less-likely bug when truncating at a positive
leap second that has a nonpositive correction.
zic -r now reports an error if given rolling leap seconds, as this
usage has never generally worked and is evidently unused.
zic now generates a POSIX-conforming TZ string for TZif files
where all-year DST is predicted for the indefinite future.
For example, for all-year Eastern Daylight Time, zic now generates
"XXX3EDT4,0/0,J365/23" where it previously generated
"EST5EDT,0/0,J365/25" or "". (Thanks to Michael Deckers for
noting the possibility of POSIX conformance.)
zic.c no longer requires sys/wait.h (thanks to spazmodius for
noting it wasn't needed).
When reading slim TZif files, zdump no longer mishandles leap
seconds on the rare platforms where time_t counts leap seconds,
fixing a bug introduced in 2014g.
zdump -v now outputs timestamps at boundaries of what localtime
and gmtime can represent, instead of the less-useful timestamps
one day after the minimum and one day before the maximum.
(Thanks to Arthur David Olson for prototype code, and to Manuela
Friedrich for debugging help.)
zdump's -c and -t options are now consistently inclusive for the
lower time bound and exclusive for the upper. Formerly they were
inconsistent. (Confusion noted by Martin Burnicki.)
Changes to build procedure
You can now compile with -DHAVE_MALLOC_ERRNO=0 to port to
non-POSIX hosts where malloc doesn't set errno.
(Problem reported by Jan Engelhardt.)
Changes to documentation
tzfile.5 better matches a draft successor to RFC 8536
<https://datatracker.ietf.org/doc/draft-murchison-rfc8536bis/01/>.
diffstat:
lib/libc/time/CONTRIBUTING | 15 +-
lib/libc/time/Makefile | 49 +-
lib/libc/time/NEWS | 296 +++++++++++++++-
lib/libc/time/SECURITY | 15 +
lib/libc/time/difftime.c | 8 +-
lib/libc/time/localtime.c | 455 +++++++++++++----------
lib/libc/time/private.h | 76 ++-
lib/libc/time/strftime.c | 16 +-
lib/libc/time/theory.html | 39 +-
lib/libc/time/tz-art.html | 18 +-
lib/libc/time/tz-link.html | 82 ++-
lib/libc/time/tzfile.5 | 136 +++++-
lib/libc/time/version | 2 +-
lib/libc/time/zdump.8 | 30 +-
lib/libc/time/zdump.c | 234 ++++++++----
lib/libc/time/zic.8 | 60 +-
lib/libc/time/zic.c | 860 ++++++++++++++++++++++++++------------------
17 files changed, 1566 insertions(+), 825 deletions(-)
diffs (truncated from 4485 to 300 lines):
diff -r b156dce21461 -r 9b66182d0ea6 lib/libc/time/CONTRIBUTING
--- a/lib/libc/time/CONTRIBUTING Fri Oct 22 13:53:20 2021 +0000
+++ b/lib/libc/time/CONTRIBUTING Fri Oct 22 14:26:04 2021 +0000
@@ -26,8 +26,11 @@
reliable sources as justification. Citations should use https: URLs
if available.
+For changes that fix sensitive security-related bugs, please see the
+file SECURITY.
+
Please submit changes against either the latest release in
-<https://www.iana.org/time-zones> or the master branch of the development
+<https://www.iana.org/time-zones> or the main branch of the development
repository. The latter is preferred. If you use Git the following
workflow may be helpful:
@@ -36,9 +39,9 @@
git clone https://github.com/eggert/tz.git
cd tz
- * Get current with the master branch.
+ * Get current with the main branch.
- git checkout master
+ git checkout main
git pull
* Switch to a new branch for the changes. Choose a different
@@ -70,17 +73,17 @@
* Create patch files 0001-*, 0002-*, ...
- git format-patch master
+ git format-patch main
* After reviewing the patch files, send the patches to tz%iana.org@localhost
for others to review.
- git send-email master
+ git send-email main
For an archived example of such an email, see
<https://mm.icann.org/pipermail/tz/2018-February/026122.html>.
- * Start anew by getting current with the master branch again
+ * Start anew by getting current with the main branch again
(the second step above).
Please do not create issues or pull requests on GitHub, as the
diff -r b156dce21461 -r 9b66182d0ea6 lib/libc/time/Makefile
--- a/lib/libc/time/Makefile Fri Oct 22 13:53:20 2021 +0000
+++ b/lib/libc/time/Makefile Fri Oct 22 14:26:04 2021 +0000
@@ -45,9 +45,9 @@
#
# Any other value for POSIXRULES is obsolete and should not be relied on, as:
# * It does not work correctly in popular implementations such as GNU/Linux.
-# * It does not work in the tzdb implementation for timestamps after 2037.
-# * It is incompatible with 'zic -b slim' if POSIXRULES specifies transitions
-# at standard time or UT rather than at local time.
+# * It does not work even in tzcode, except for historical timestamps
+# that precede the last explicit transition in the POSIXRULES file.
+# Hence it typically does not work for current and future timestamps.
# In short, software should avoid ruleless settings like TZ='EET-2EEST'
# and so should not depend on the value of POSIXRULES.
#
@@ -122,8 +122,8 @@
# Types to try, as an alternative to time_t.
TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
-TIME_T_ALTERNATIVES_HEAD = int64_t
-TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
+TIME_T_ALTERNATIVES_HEAD = int_least64_t
+TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
# What kind of TZif data files to generate. (TZif is the binary time
# zone data format that zic generates; see Internet RFC 8536.)
@@ -152,8 +152,10 @@
# The EXPIRES_LINE value matters only if REDO's value contains "right".
# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
# zic's support for the Expires line was introduced in tzdb 2020a,
-# and EXPIRES_LINE defaults to 0 for now so that the leapseconds file
-# can be given to older zic implementations.
+# and was modified in tzdb 2021b to generate version 4 TZif files.
+# EXPIRES_LINE defaults to 0 for now so that the leapseconds file
+# can be given to pre-2020a zic implementations and so that TZif files
+# built by newer zic implementations can be read by pre-2021b libraries.
EXPIRES_LINE= 0
# To install data in text form that has all the information of the TZif data,
@@ -210,6 +212,7 @@
# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
# localtime_rz can make zdump significantly faster, but is nonstandard.
+# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
# functions like 'link' or variables like 'tzname' required by POSIX
# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
@@ -220,7 +223,6 @@
# -DHAVE_STRTOLL=0 if your system lacks the strtoll function
# -DHAVE_SYMLINK=0 if your system lacks the symlink function
# -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
-# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
# -DHAVE_TZSET=0 if your system lacks a tzset function
# -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
# -Dlocale_t=XXX if your system uses XXX instead of locale_t
@@ -257,22 +259,26 @@
GCC_INSTRUMENT = \
-fsanitize=undefined -fsanitize-address-use-after-scope \
-fsanitize-undefined-trap-on-error -fstack-protector
+# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
$(GCC_INSTRUMENT) \
-Wall -Wextra \
-Walloc-size-larger-than=100000 -Warray-bounds=2 \
-Wbad-function-cast -Wcast-align=strict -Wdate-time \
-Wdeclaration-after-statement -Wdouble-promotion \
+ -Wduplicated-branches -Wduplicated-cond \
-Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
- -Winit-self -Wjump-misses-init -Wlogical-op \
+ -Winit-self -Wlogical-op \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
+ -Wnull-dereference \
-Wold-style-definition -Woverlength-strings -Wpointer-arith \
- -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=4 \
+ -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
+ -Wstrict-prototypes -Wstringop-overflow=4 \
-Wstringop-truncation -Wsuggest-attribute=cold \
-Wsuggest-attribute=const -Wsuggest-attribute=format \
-Wsuggest-attribute=malloc \
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
- -Wtrampolines -Wundef -Wuninitialized -Wunused \
+ -Wtrampolines -Wundef -Wuninitialized -Wunused-macros \
-Wvariadic-macros -Wvla -Wwrite-strings \
-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
-Wno-type-limits -Wno-unused-parameter
@@ -498,7 +504,7 @@
tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
date.1.txt
COMMON= calendars CONTRIBUTING LICENSE Makefile \
- NEWS README theory.html version
+ NEWS README SECURITY theory.html version
WEB_PAGES= tz-art.html tz-how-to.html tz-link.html
CHECK_WEB_PAGES=check_theory.html check_tz-art.html \
check_tz-how-to.html check_tz-link.html
@@ -523,7 +529,7 @@
TZS_CUTOFF_FLAG= -c $(TZS_YEAR)
TZS= to$(TZS_YEAR).tzs
TZS_NEW= to$(TZS_YEAR)new.tzs
-TZS_DEPS= $(PRIMARY_YDATA) asctime.c localtime.c \
+TZS_DEPS= $(YDATA) asctime.c localtime.c \
private.h tzfile.h zdump.c zic.c
# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
EIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi
@@ -533,7 +539,7 @@
# This list is not the same as the output of 'git ls-files', since
# .gitignore is not distributed.
VERSION_DEPS= \
- calendars CONTRIBUTING LICENSE Makefile NEWS README \
+ calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
africa antarctica asctime.c asia australasia \
backward backzone \
checklinks.awk checktab.awk \
@@ -757,7 +763,7 @@
sharp='#' && \
! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
$(MISC) $(SOURCES) $(WEB_PAGES) \
- CONTRIBUTING LICENSE README \
+ CONTRIBUTING LICENSE README SECURITY \
version tzdata.zi && \
! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
Makefile && \
@@ -796,9 +802,10 @@
$(AWK) -f checklinks.awk tzdata.zi
touch $@
-check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
+check_tables: checktab.awk $(YDATA) backward $(ZONETABLES)
for tab in $(ZONETABLES); do \
- $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
+ test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
+ $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
|| exit; \
done
touch $@
@@ -952,6 +959,12 @@
public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
done
public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
+ :
+ : Also check 'backzone' syntax.
+ rm public.dir/main.zi
+ cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
+ public.dir/zic -d public.dir/zoneinfo main.zi
+ :
rm -fr public.dir
touch $@
@@ -964,7 +977,7 @@
mkdir $@.dir
ln $(VERSION_DEPS) $@.dir
case $@ in \
- int32_t) range=-2147483648,2147483648;; \
+ int*32_t) range=-2147483648,2147483648;; \
u*) range=0,4294967296;; \
*) range=-4294967296,4294967296;; \
esac && \
diff -r b156dce21461 -r 9b66182d0ea6 lib/libc/time/NEWS
--- a/lib/libc/time/NEWS Fri Oct 22 13:53:20 2021 +0000
+++ b/lib/libc/time/NEWS Fri Oct 22 14:26:04 2021 +0000
@@ -1,5 +1,291 @@
News for the tz database
+Release 2021e - 2021-10-21 18:41:00 -0700
+
+ Changes to future timestamps
+
+ Palestine will fall back 10-29 (not 10-30) at 01:00.
+ (Thanks to P Chan and Heba Hemad.)
+
+
+Release 2021d - 2021-10-15 13:48:18 -0700
+
+ Briefly:
+ Fiji suspends DST for the 2021/2022 season.
+ 'zic -r' marks unspecified timestamps with "-00".
+
+ Changes to future timestamps
+
+ Fiji will suspend observance of DST for the 2021/2022 season.
+ Assume for now that it will return next year. (Thanks to Jashneel
+ Kumar and P Chan.)
+
+ Changes to code
+
+ 'zic -r' now uses "-00" time zone abbreviations for intervals
+ with UT offsets that are unspecified due to -r truncation.
+ This implements a change in draft Internet RFC 8536bis.
+
+
+Release 2021c - 2021-10-01 14:21:49 -0700
+
+ Briefly:
+ Revert most 2021b changes to 'backward'.
+ Fix 'zic -b fat' bug in pre-1970 32-bit data.
+ Fix two Link line typos.
+ Distribute SECURITY file.
+
+ This release is intended as a bugfix release, to fix compatibility
+ problems and typos reported since 2021b was released.
+
+ Changes to Link directives
+
+ Revert almost all of 2021b's changes to the 'backward' file,
+ by moving Link directives back to where they were in 2021a.
+ Although 'zic' doesn't care which source file contains a Link
+ directive, some downstream uses ran into trouble with the move.
+ (Problem reported by Stephen Colebourne for Joda-Time.)
+
+ Fix typo that linked Atlantic/Jan_Mayen to the wrong location
+ (problem reported by Chris Walton).
+
+ Fix 'backzone' typo that linked America/Virgin to the wrong
+ location (problem reported by Michael Deckers).
+
+ Changes to code
+
+ Fix a bug in 'zic -b fat' that caused old timestamps to be
+ mishandled in 32-bit-only readers (problem reported by Daniel
+ Fischer).
+
+ Changes to documentation
+
+ Distribute the SECURITY file (problem reported by Andreas Radke).
+
+
+Release 2021b - 2021-09-24 16:23:00 -0700
+
+ Briefly:
+ Jordan now starts DST on February's last Thursday.
+ Samoa no longer observes DST.
+ Merge more location-based Zones whose timestamps agree since 1970.
+ Move some backward-compatibility links to 'backward'.
+ Rename Pacific/Enderbury to Pacific/Kanton.
+ Correct many pre-1993 transitions in Malawi, Portugal, etc.
+ zic now creates each output file or link atomically.
+ zic -L no longer omits the POSIX TZ string in its output.
+ zic fixes for truncation and leap second table expiration.
+ zic now follows POSIX for TZ strings using all-year DST.
+ Fix some localtime crashes and bugs in obscure cases.
+ zdump -v now outputs more-useful boundary cases.
+ tzfile.5 better matches a draft successor to RFC 8536.
+ A new file SECURITY.
+
+ This release is prompted by recent announcements by Jordan and Samoa.
+ It incorporates many other changes that had accumulated since 2021a.
+ However, it omits most proposed changes that merged all Zones
+ agreeing since 1970, as concerns were raised about doing too many of
+ these changes at once. It does keeps some of these changes in the
+ interest of making tzdb more equitable one step at a time; see
+ "Merge more location-based Zones" below.
Home |
Main Index |
Thread Index |
Old Index