Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time Merge 2018e



details:   https://anonhg.NetBSD.org/src/rev/ecf0195e9cb5
branches:  trunk
changeset: 318749:ecf0195e9cb5
user:      christos <christos%NetBSD.org@localhost>
date:      Fri May 04 15:51:00 2018 +0000
description:
Merge 2018e

  Changes to code

    zic now accepts subsecond precision in expressions like
    00:19:32.13, which is approximately the legal time of the
    Netherlands from 1835 to 1937.  However, because it is
    questionable whether the few recorded uses of non-integer offsets
    had subsecond precision in practice, there are no plans for tzdata
    to use this feature.  (Thanks to Steve Allen for pointing out
    the limitations of historical data in this area.)

    The code is a bit more portable to MS-Windows.  Installers can
    compile with -DRESERVE_STD_EXT_IDS on MS-Windows platforms that
    reserve identifiers like 'localtime'.  (Thanks to Manuela
    Friedrich).

  Changes to documentation and commentary

    theory.html now outlines tzdb's extensions to POSIX's model for
    civil time, and has a section "POSIX features no longer needed"
    that lists POSIX API components that are now vestigial.
    (From suggestions by Steve Summit.)  It also better distinguishes
    time zones from tz regions.  (From a suggestion by Guy Harris.)

    Commentary is now more consistent about using the phrase "daylight
    saving time", to match the C name tm_isdst.  Daylight saving time
    need not occur in summer, and need not have a positive offset from
    standard time.

    Commentary about historical transitions in Uruguay has been expanded
    with links to many relevant legal documents.
    (Thanks to Tim Parenti.)

    Commentary now uses some non-ASCII characters with Unicode value
    less than U+0100, as they can be useful and should work even with
    older editors such as XEmacs.

diffstat:

 lib/libc/time/CONTRIBUTING |    12 +-
 lib/libc/time/Makefile     |   176 +++-
 lib/libc/time/NEWS         |   209 +++++-
 lib/libc/time/asctime.c    |    16 +-
 lib/libc/time/ctime.3      |    13 +-
 lib/libc/time/localtime.c  |    30 +-
 lib/libc/time/private.h    |    38 +-
 lib/libc/time/strftime.c   |     6 +-
 lib/libc/time/theory.html  |  1776 ++++++++++++++++++++++++-------------------
 lib/libc/time/tz-art.htm   |   586 --------------
 lib/libc/time/tz-art.html  |   610 +++++++++++++++
 lib/libc/time/tz-link.htm  |   921 ----------------------
 lib/libc/time/tz-link.html |   953 +++++++++++++++++++++++
 lib/libc/time/tzset.3      |    52 +-
 lib/libc/time/version      |     2 +-
 lib/libc/time/zdump.c      |    16 +-
 lib/libc/time/zic.8        |    39 +-
 lib/libc/time/zic.c        |   109 +-
 18 files changed, 3110 insertions(+), 2454 deletions(-)

diffs (truncated from 6675 to 300 lines):

diff -r 2edbf268e193 -r ecf0195e9cb5 lib/libc/time/CONTRIBUTING
--- a/lib/libc/time/CONTRIBUTING        Fri May 04 14:50:40 2018 +0000
+++ b/lib/libc/time/CONTRIBUTING        Fri May 04 15:51:00 2018 +0000
@@ -25,7 +25,8 @@
 
 Please submit changes against either the latest release in
 <https://www.iana.org/time-zones> or the master branch of the development
-repository.  If you use Git the following workflow may be helpful:
+repository.  The latter is preferred.  If you use Git the following
+workflow may be helpful:
 
   * Copy the development repository.
 
@@ -42,6 +43,12 @@
 
       git checkout -b mybranch
 
+  * Sleuth by using 'git blame'.  For example, when fixing data for
+    Africa/Sao_Tome, if the command 'git blame africa' outputs a line
+    '2951fa3b (Paul Eggert 2018-01-08 09:03:13 -0800 1068) Zone
+    Africa/Sao_Tome 0:26:56 - LMT 1884', commit 2951fa3b should
+    provide some justification for the 'Zone Africa/Sao_Tome' line.
+
   * Edit source files.  Include commentary that justifies the
     changes by citing reliable sources.
 
@@ -67,6 +74,9 @@
 
       git send-email master
 
+    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
     (the second step above).
 
diff -r 2edbf268e193 -r ecf0195e9cb5 lib/libc/time/Makefile
--- a/lib/libc/time/Makefile    Fri May 04 14:50:40 2018 +0000
+++ b/lib/libc/time/Makefile    Fri May 04 15:51:00 2018 +0000
@@ -10,9 +10,18 @@
 # Email address for bug reports.
 BUGEMAIL=      tz%iana.org@localhost
 
+# Choose source data features.  To get new features right away, use:
+#      DATAFORM=       vanguard
+# To wait a while before using new features, to give downstream users
+# time to upgrade zic (the default), use:
+#      DATAFORM=       main
+# To wait even longer for new features, use:
+#      DATAFORM=       rearguard
+DATAFORM=              main
+
 # Change the line below for your time zone (after finding the zone you want in
 # the time zone files, or adding it to a time zone file).
-# Alternately, if you discover you've got the wrong time zone, you can just
+# Alternatively, if you discover you've got the wrong time zone, you can just
 #      zic -l rightzone
 # to correct things.
 # Use the command
@@ -25,11 +34,11 @@
 # for handling POSIX-style time zone environment variables,
 # change the line below (after finding the zone you want in the
 # time zone files, or adding it to a time zone file).
-# (When a POSIX-style environment variable is handled, the rules in the
+# When a POSIX-style environment variable is handled, the rules in the
 # template file are used to determine "spring forward" and "fall back" days and
 # times; the environment variable itself specifies UT offsets of standard and
-# summer time.)
-# Alternately, if you discover you've got the wrong time zone, you can just
+# daylight saving time.
+# Alternatively, if you discover you've got the wrong time zone, you can just
 #      zic -p rightzone
 # to correct things.
 # Use the command
@@ -189,13 +198,18 @@
 #  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
 #  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
 #  -DHAVE_STRDUP=0 if your system lacks the strdup function
+#  -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
+#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
+#      with external linkage, e.g., applications cannot define 'localtime'.
 #  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
+#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
+#      security implications and is not recommended for general use
 #  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
 #      not needed by the main-program tz code, which is single-threaded.
 #      Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
@@ -222,14 +236,16 @@
   $(GCC_INSTRUMENT) \
   -Wall -Wextra \
   -Walloc-size-larger-than=100000 -Warray-bounds=2 \
-  -Wbad-function-cast -Wcast-align -Wdate-time \
+  -Wbad-function-cast -Wcast-align=strict -Wdate-time \
   -Wdeclaration-after-statement -Wdouble-promotion \
   -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
   -Winit-self -Wjump-misses-init -Wlogical-op \
   -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
   -Wold-style-definition -Woverlength-strings -Wpointer-arith \
-  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
+  -Wshadow -Wshift-overflow=2 -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 \
   -Wvariadic-macros -Wvla -Wwrite-strings \
@@ -394,13 +410,19 @@
 SAFE_CHARSET=  $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
 SAFE_CHAR=     '[]'$(SAFE_CHARSET)'-]'
 
+# Non-ASCII non-letters that OK_CHAR allows, as these characters are
+# useful in commentary.  XEmacs 21.5.34 displays them correctly,
+# presumably because they are Latin-1.
+UNUSUAL_OK_CHARSET= °±½¾�
+
 # OK_CHAR matches any character allowed in the distributed files.
-# This is the same as SAFE_CHAR, except that multibyte letters are
-# also allowed so that commentary can contain people's names and quote
-# non-English sources.  For non-letters the sources are limited to
-# ASCII renderings for the convenience of maintainers whose text editors
-# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
-OK_CHAR=       '[][:alpha:]'$(SAFE_CHARSET)'-]'
+# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
+# multibyte letters are also allowed so that commentary can contain a
+# few safe symbols and people's names and can quote non-English sources.
+# Other non-letters are limited to ASCII renderings for the
+# convenience of maintainers using XEmacs 21.5.34, which by default
+# mishandles Unicode characters U+0100 and greater.
+OK_CHAR=       '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
 
 # SAFE_LINE matches a line of safe characters.
 # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
@@ -462,10 +484,12 @@
 ZONETABLES=    zone1970.tab zone.tab
 TABDATA=       iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
 LEAP_DEPS=     leapseconds.awk leap-seconds.list
-TZDATA_ZI_DEPS=        zishrink.awk version $(TDATA) $(PACKRATDATA)
+TZDATA_ZI_DEPS=        ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
+DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
 DATA=          $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
                        leapseconds yearistype.sh $(ZONETABLES)
-AWK_SCRIPTS=   checklinks.awk checktab.awk leapseconds.awk zishrink.awk
+AWK_SCRIPTS=   checklinks.awk checktab.awk leapseconds.awk \
+                       ziguard.awk zishrink.awk
 MISC=          $(AWK_SCRIPTS) zoneinfo2tdf.pl
 TZS_YEAR=      2050
 TZS=           to$(TZS_YEAR).tzs
@@ -492,6 +516,7 @@
                tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
                workman.sh yearistype.sh \
                zdump.8 zdump.c zic.8 zic.c \
+               ziguard.awk zishrink.awk \
                zone.tab zone1970.tab zoneinfo2tdf.pl
 
 # And for the benefit of csh users on systems that assume the user
@@ -499,7 +524,8 @@
 
 SHELL=         /bin/sh
 
-all:           tzselect yearistype zic zdump libtz.a $(TABDATA)
+all:           tzselect yearistype zic zdump libtz.a $(TABDATA) \
+                 vanguard.zi main.zi rearguard.zi
 
 ALL:           all date $(ENCHILADA)
 
@@ -534,11 +560,15 @@
                printf '%s\n' "$$V" >$@.out
                mv $@.out $@
 
-# This file can be tailored by setting BACKWARD, PACKRATDATA, etc.
-tzdata.zi:     $(TZDATA_ZI_DEPS)
+# These files can be tailored by setting BACKWARD, PACKRATDATA, etc.
+vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
+               $(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \
+                 $(TDATA) $(PACKRATDATA) >$@.out
+               mv $@.out $@
+tzdata.zi:     $(DATAFORM).zi version
                version=`sed 1q version` && \
                  LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \
-                   $(TDATA) $(PACKRATDATA) >$@.out
+                   $(DATAFORM).zi >$@.out
                mv $@.out $@
 
 version.h:     version
@@ -614,19 +644,29 @@
 
 zones:         $(REDO)
 
+# dummy.zd is not a real file; it is mentioned here only so that the
+# top-level 'make' does not have a syntax error.
+ZDS = dummy.zd
+# Rule used only by submakes invoked by the $(TZS_NEW) rule.
+# It is separate so that GNU 'make -j' can run instances in parallel.
+$(ZDS): zdump
+               ./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@
+
 $(TZS_NEW):    tzdata.zi zdump zic
-               mkdir -p tzs.dir
+               rm -fr tzs.dir
+               mkdir tzs.dir
                $(zic) -d tzs.dir tzdata.zi
                $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
                   tzdata.zi | LC_ALL=C sort >$@.out
                wd=`pwd` && \
-               zones=`$(AWK) -v wd="$$wd" \
-                               '/^Z/{print wd "/tzs.dir/" $$2}' tzdata.zi \
-                        | LC_ALL=C sort` && \
-               ./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
-               sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out
-               rm -fr tzs.dir $@.out
-               mv $@.sed.out $@
+               set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \
+                       | LC_ALL=C sort -t . -k 2,2` && \
+               shift && \
+               ZDS=$$* && \
+               $(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \
+               sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out
+               rm -fr tzs.dir
+               mv $@.out $@
 
 # If $(TZS) does not already exist (e.g., old-format tarballs), create it.
 # If it exists but 'make check_tzs' fails, a maintainer should inspect the
@@ -669,8 +709,10 @@
                sharp='#' && \
                ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
                        $(MISC) $(SOURCES) $(WEB_PAGES) \
-                       CONTRIBUTING LICENSE Makefile README \
+                       CONTRIBUTING LICENSE README \
                        version tzdata.zi && \
+               ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \
+                       Makefile && \
                ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
                        leapseconds yearistype.sh zone.tab && \
                ! grep -Env $(OK_LINE) $(ENCHILADA); \
@@ -702,7 +744,7 @@
                $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
                  LC_ALL=C sort -cu
 
-check_links:   checklinks.awk $(TDATA_TO_CHECK)
+check_links:   checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
                $(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
                $(AWK) -f checklinks.awk tzdata.zi
 
@@ -720,17 +762,26 @@
 check_web:     tz-how-to.html
                $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
 
-# Check that tzdata.zi generates the same binary data that its sources do.
-check_zishrink: tzdata.zi zic leapseconds $(PACKRATDATA) $(TDATA)
+# Check that zishrink.awk does not alter the data, and that ziguard.awk
+# preserves main-format data.
+check_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \
+                 $(DATAFORM).zi tzdata.zi
                for type in posix right; do \
-                 mkdir -p time_t.dir/$$type time_t.dir/$$type-shrunk && \
+                 mkdir -p time_t.dir/$$type time_t.dir/$$type-t \
+                   time_t.dir/$$type-shrunk && \
                  case $$type in \
                    right) leap='-L leapseconds';; \
                    *) leap=;; \
                  esac && \
-                 $(ZIC) $$leap -d time_t.dir/$$type $(TDATA) && \
-                 $(AWK) '/^Rule/' $(TDATA) | \
-                   $(ZIC) $$leap -d time_t.dir/$$type - $(PACKRATDATA) && \
+                 $(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \
+                 case $(DATAFORM) in \
+                   main) \
+                     $(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \
+                     $(AWK) '/^Rule/' $(TDATA) | \
+                       $(ZIC) $$leap -d time_t.dir/$$type-t - \
+                         $(PACKRATDATA) && \
+                     diff -r time_t.dir/$$type time_t.dir/$$type-t;; \
+                 esac && \
                  $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
                  diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
                done
@@ -740,7 +791,7 @@
                rm -f core *.o *.out \
                  date tzselect version.h zdump zic yearistype libtz.a
 clean:         clean_misc
-               rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW)
+               rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW)
 
 maintainer-clean: clean
                @echo 'This command is intended for maintainers to use; it'
@@ -852,16 +903,27 @@
                done
                rm -fr time_t.dir
 
+TRADITIONAL_ASC = \
+  tzcode$(VERSION).tar.gz.asc \
+  tzdata$(VERSION).tar.gz.asc
+ALL_ASC = $(TRADITIONAL_ASC) \
+  tzdata$(VERSION)-rearguard.tar.gz.asc \



Home | Main Index | Thread Index | Old Index