[PROPOSED 1/5] * tzfile.5: Typeset ‘-’ more carefully.
--- tzfile.5 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tzfile.5 b/tzfile.5 index d13029c..69f8860 100644 --- a/tzfile.5 +++ b/tzfile.5 @@ -119,13 +119,13 @@ that follow the structure(s) in the file. The .I tt_utoff -value is never equal to -2**31, to let 32-bit clients negate it without +value is never equal to \-2**31, to let 32-bit clients negate it without overflow. Also, in realistic applications .I tt_utoff -is in the range [-89999, 93599] (i.e., more than -25 hours and less +is in the range [\-89999, 93599] (i.e., more than \-25 hours and less than 26 hours); this allows easy support by implementations that -already support the POSIX-required range [-24:59:59, 25:59:59]. +already support the POSIX-required range [\-24:59:59, 25:59:59]. .IP * .I tzh_leapcnt pairs of four-byte values, written in network byte order; @@ -204,7 +204,7 @@ For version-3-format timezone files, the POSIX-TZ-style string may use two minor extensions to the POSIX TZ format, as described in .BR newtzset (3). First, the hours part of its transition times may be signed and range from -\*-167 through 167 instead of the POSIX-required unsigned values +\-167 through 167 instead of the POSIX-required unsigned values from 0 through 24. Second, DST is in effect all year if it starts January 1 at 00:00 and ends December 31 at 24:00 plus the difference @@ -239,7 +239,7 @@ in the version 1 data block to save space. Time zone designations should consist of at least three (3) and no more than six (6) ASCII characters from the set of alphanumerics, -.q "-", +.q "\*-", and .q "+". This is for compatibility with POSIX requirements for @@ -298,11 +298,11 @@ mishandled by version 2 readers. Some readers designed for version 2 do not support permanent daylight saving time, e.g., a TZ string .q "EST5EDT,0/0,J365/25" -denoting permanent Eastern Daylight Time (\*-04). +denoting permanent Eastern Daylight Time (\-04). As a partial workaround, a writer can substitute standard time for the next time zone east, e.g., .q "AST4" -for permanent Atlantic Standard Time (\*-04). +for permanent Atlantic Standard Time (\-04). .IP * Some readers ignore the footer, and instead predict future timestamps from the time type of the last transition. @@ -316,17 +316,17 @@ As a partial workaround, a writer can output a dummy (no-op) first transition at an early time. .IP * Some readers mishandle timestamps before the first -transition that has a timestamp not less than -2**31. +transition that has a timestamp not less than \-2**31. Readers that support only 32-bit timestamps are likely to be more prone to this problem, for example, when they process 64-bit transitions only some of which are representable in 32 bits. As a partial workaround, a writer can output a dummy -transition at timestamp \*-2**31. +transition at timestamp \-2**31. .IP * Some readers mishandle a transition if its timestamp has the minimum possible signed 64-bit value. -Timestamps less than \*-2**59 are not recommended. +Timestamps less than \-2**59 are not recommended. .IP * Some readers mishandle POSIX-style TZ strings that contain @@ -347,7 +347,7 @@ These characters are not recommended. Some readers may mishandle time zone abbreviations that contain fewer than 3 or more than 6 characters, or that contain ASCII characters other than alphanumerics, -.q "-", +.q "\*-", and .q "+". These abbreviations are not recommended. @@ -381,18 +381,18 @@ Readers that do not support negative timestamps are likely to be more prone to this problem. .IP * Some readers mishandle time zone abbreviations like -.q "-08" +.q "\*-08" that contain .q "+", -.q "-", +.q "\*-", or digits. .IP * Some readers mishandle UT offsets that are out of the -traditional range of \*-12 through +12 hours, and so do not +traditional range of \-12 through +12 hours, and so do not support locations like Kiritimati that are outside this range. .IP * -Some readers mishandle UT offsets in the range [\*-3599, \*-1] +Some readers mishandle UT offsets in the range [\-3599, \-1] seconds from UT, because they integer-divide the offset by 3600 to get 0 and then display the hour part as .q "+00". -- 2.21.0
* zic.8: Fix tab alignment of Link lines. Work even on devices that cannot represent “7°26′22.50″”. --- zic.8 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zic.8 b/zic.8 index 3a4d96f..9c42ae6 100644 --- a/zic.8 +++ b/zic.8 @@ -83,6 +83,7 @@ as local time. will act as if the input contained a link line of the form .sp .ti +.5i +.ta \w'Link\0\0'u +\w'\fItimezone\fP\0\0'u Link \fItimezone\fP localtime .TP .BI "\*-L " leapsecondfilename @@ -674,7 +675,11 @@ Link Europe/Zurich Europe/Vaduz In this example, the timezone is named Europe/Zurich but it has an alias as Europe/Vaduz. This example says that Zurich was 34 minutes and 8 seconds east of UT until 1853-07-16 at 00:00, when the legal offset -was changed to 7\(de\|26\(fm\|22.50\(sd, which works out to 0:29:45.50; +was changed to +.ds o 7 degrees 26 minutes 22.50 seconds +.if \n(.g .if c \(de .if c \(fm .if c \(sd .ds o 7\(de\|26\(fm\|22.50\(sd +\*o, +which works out to 0:29:45.50; .B zic treats this by rounding it to 0:29:46. After 1894-06-01 at 00:00 the UT offset became one hour -- 2.21.0
zic’s -p option was intended as a transition from historical System V code that treated TZ="XXXnYYY" as meaning US daylight-saving rules in a time zone n hours west of UT, with XXX abbreviating standard time and YYY abbreviating DST. zic -p allows the tzdata installer to specify (say) Europe/Brussels's rules instead of US rules. This behavior is not well documented and often fails in practice; for example it does not work with current glibc for contemporary timestamps, and it does not work in tzdb itself for timestamps after 2037. So, document it as being obsolete, with the intent that it will be removed in a future version. This change does not affect behavior of the default installation. * Makefile, NEWS, tzfile.5, zic.8: Adjust comments and documentation accordingly. * Makefile (install): Add support for empty POSIXRULES, which now means not to use zic -p when installing. --- Makefile | 21 +++++++++++++++++---- NEWS | 11 +++++++++++ tzfile.5 | 18 ++++++++++-------- zic.8 | 7 +++++-- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 35db07d..cda95ea 100644 --- a/Makefile +++ b/Makefile @@ -35,11 +35,13 @@ DATAFORM= main LOCALTIME= GMT -# If you want something other than Eastern United States time as a template -# for handling ruleless POSIX-style timezone environment variables, +# The POSIXRULES macro controls interpretation of nonstandard and obsolete +# POSIX-like TZ settings like TZ=’EET-2EEST’ that lack DST transition rules. +# In the reference implementation, if you want something other than Eastern +# United States time as a template for handling these settings, you can # change the line below (after finding the timezone you want in the # one of the $(TDATA) source files, or adding it to a source file). -# A ruleless environment setting like TZ='CST6CDT' uses the rules in the +# A setting like TZ='EET-2EEST' is supposed to use the rules in the # template file to determine "spring forward" and "fall back" days and # times; the environment variable itself specifies UT offsets of standard and # daylight saving time. @@ -49,6 +51,15 @@ LOCALTIME= GMT # Use the command # make zonenames # to get a list of the values you can use for POSIXRULES. +# +# If POSIXRULES is empty, no template is installed; this is the intended +# future default for POSIXRULES. +# +# Nonempty POSIXRULES is obsolete and should not be relied on, because: +# * It does not work correctly in popular implementations such as GNU/Linux. +# * It does not work in the tzdb implementation for timestamps after 2037. +# In short, software should avoid ruleless settings like TZ='EET-2EEST' +# and so should not depend on the value of POSIXRULES. POSIXRULES= America/New_York @@ -570,7 +581,9 @@ install: all $(DATA) $(REDO) $(MANS) '$(DESTDIR)$(LIBDIR)' \ '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ '$(DESTDIR)$(MANDIR)/man8' - $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \ + $(ZIC_INSTALL) -l $(LOCALTIME) \ + `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ + ` $(POSIXRULES) \ -t '$(DESTDIR)$(TZDEFAULT)' cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' cp tzselect '$(DESTDIR)$(BINDIR)/.' diff --git a/NEWS b/NEWS index 7aaae11..fffe1b6 100644 --- a/NEWS +++ b/NEWS @@ -73,6 +73,17 @@ Unreleased, experimental changes Changes to documentation and commentary + The Makefile now documents the POSIXRULES macro as being obsolete, + and similarly, zic's -p POSIXRULES option is now documented as + being obsolete. Although the POSIXRULES feature still exists and + works as before, in practice it is rarely used for its intended + purpose, and it does not work either in the default reference + implementation (for timestamps after 2037) or in common + implementations such as GNU/Linux (for contemporary timestamps). + Since POSIXRULES was designed primarily as a temporary transition + facility for System V platforms that died off decades ago, it is + being decommissioned rather than institutionalized. + New info on Bonin Islands and Marcus (thanks to Wakaba and Phake Nick.) diff --git a/tzfile.5 b/tzfile.5 index 69f8860..cd4c483 100644 --- a/tzfile.5 +++ b/tzfile.5 @@ -156,15 +156,17 @@ must also be set. The standard/wall and UT/local indicators were designed for transforming a TZif file's transition times into transitions appropriate for another time zone specified via a POSIX-style TZ string that lacks rules. -For example, when TZ="AKST9AKDT" and there is no TZif file "AKST9AKDT", -the transition times might be adapted from a TZif file with the +For example, when TZ="EET\*-2EEST" and there is no TZif file "EET\*-2EEST", +the idea was to adapt the transition times from a TZif file with the well-known name "posixrules" that is present only for this purpose and -is a copy of the file "America/New_York", a file with a different UT offset. -POSIX does not specify this obsolescent transformational behavior and -widely used platforms such as GNU/Linux do not support it correctly, so users -desiring Alaska time should specify TZ="America/Anchorage" for better -historical coverage, or TZ="AKST9AKDT,M3.2.0,M11.1.0" for POSIX -conformance and coverage for recent timestamps only. +is a copy of the file "Europe/Brussels", a file with a different UT offset. +POSIX does not specify this obsolete transformational behavior, +the default rules are installation-dependent, and no implementation +is known to support this feature for timestamps past 2037, +so users desiring (say) Greek time should instead specify +TZ="Europe/Athens" for better historical coverage, falling back on +TZ="EET\*-2EEST,M3.5.0/3,M10.5.0/4" if POSIX conformance is required +and older timestamps need not be handled accurately. .PP The .BR localtime (3) diff --git a/zic.8 b/zic.8 index 9c42ae6..4bf69a5 100644 --- a/zic.8 +++ b/zic.8 @@ -94,13 +94,16 @@ no leap second information appears in output files. .BI "\*-p " timezone Use .IR timezone 's -rules when handling POSIX-format -TZ strings like "CST6CDT" that lack transition rules. +rules when handling nonstandard +TZ strings like "EET\*-2EEST" that lack transition rules. .B zic will act as if the input contained a link line of the form .sp .ti +.5i Link \fItimezone\fP posixrules +.sp +This feature is obsolete and poorly supported. +Among other things it should not be used for timestamps after the year 2037. .TP .BR "\*-r " "[\fB@\fP\fIlo\fP][\fB/@\fP\fIhi\fP]" Reduce the size of output files by limiting their applicability -- 2.21.0
The new '-b slim' option of zic now omits the isstd and isut tables in TZif files. Because the intended use of these tables often fails in practice and has been deprecated, we might as well drop them when the user specifies the new '-b slim' option. This change does not affect zic's default behavior, and does not affect the behavior of ‘zic -b slim -p America/New_York’, so the old System V behavior still works even with -b slim. * Makefile, NEWS, zic.8: Adjust comments accordingly. * zic.c (addtype): Omit isstd and isut if '-b slim'. --- Makefile | 2 ++ NEWS | 19 ++++++++++--------- zic.8 | 7 ++++++- zic.c | 2 ++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index cda95ea..81d1e86 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,8 @@ LOCALTIME= GMT # Nonempty POSIXRULES is obsolete and should not be relied on, because: # * 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. # In short, software should avoid ruleless settings like TZ='EET-2EEST' # and so should not depend on the value of POSIXRULES. diff --git a/NEWS b/NEWS index fffe1b6..53c440c 100644 --- a/NEWS +++ b/NEWS @@ -46,15 +46,16 @@ Unreleased, experimental changes test for year-2038 bugs in software that reads TZif files. 'zic -b fat' and 'zic -b slim' generate larger and smaller output; for example, changing from fat to slim shrinks the Europe/London - file from 3648 to 1625 bytes, saving about 55%. Fat and slim - files represent the same time data and use the same TZif format as - documented in tzfile(5) and in Internet RFC 8536. Fat format - attempts to work around bugs or incompatibilities on older - software that reads TZif files, notably software that mishandles - 64-bit TZif data. Slim format is more efficient and tests for - these bugs. Currently zic defaults to fat format, although this - is intended to change in future zic versions, as the buggy - software typically mishandles post-2038 timestamps anyway. + file from 3648 to 1599 bytes, saving about 56%. Fat and slim + files represent the same set of timestamps and use the same TZif + format as documented in tzfile(5) and in Internet RFC 8536. + Fat format attempts to work around bugs or incompatibilities in + older software, notably software that mishandles 64-bit TZif data + or uses obsolete TZ strings like "EET-2EEST" that lack DST rules. + Slim format is more efficient and does not work around 64-bit bugs + or obsolete TZ strings. Currently zic defaults to fat format, + although this is intended to change in future zic versions, as the + buggy software often mishandles timestamps anyway. zic no longer treats a set of rules ending in 2037 specially. Previously, zic assumed that such a ruleset meant that future diff --git a/zic.8 b/zic.8 index 4bf69a5..dc0220f 100644 --- a/zic.8 +++ b/zic.8 @@ -103,7 +103,12 @@ will act as if the input contained a link line of the form Link \fItimezone\fP posixrules .sp This feature is obsolete and poorly supported. -Among other things it should not be used for timestamps after the year 2037. +Among other things it should not be used for timestamps after the year 2037, +and it should not be combined with +.B "\*-b slim" +if +.IR timezone 's +transitions are at standard time or UT instead of local time. .TP .BR "\*-r " "[\fB@\fP\fIlo\fP][\fB/@\fP\fIhi\fP]" Reduce the size of output files by limiting their applicability diff --git a/zic.c b/zic.c index 3fb32c7..5da3ca4 100644 --- a/zic.c +++ b/zic.c @@ -2930,6 +2930,8 @@ addtype(zic_t utoff, char const *abbr, bool isdst, bool ttisstd, bool ttisut) error(_("UT offset out of range")); exit(EXIT_FAILURE); } + if (!want_bloat()) + ttisstd = ttisut = false; for (j = 0; j < charcnt; ++j) if (strcmp(&chars[j], abbr) == 0) -- 2.21.0
* Makefile, NEWS: Document -DZIC_BLOAT_DEFAULT. * zic.c (ZIC_BLOAT_DEFAULT): New macro. (main): Use it. --- Makefile | 19 ++++++++++--------- NEWS | 7 ++++--- zic.c | 6 ++++++ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 81d1e86..d305f68 100644 --- a/Makefile +++ b/Makefile @@ -244,6 +244,13 @@ LDLIBS= # other than simply getting garbage data # -DUSE_LTZ=0 to build zdump with the system time zone library # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"slim\" to default zic's -b option to "slim", and +# similarly for "fat". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably readers that mishandle 64-bit +# data in TZif files. Slim TZif files are more efficient and do not +# work around these incompatibilities and bugs. If not given, the +# current default is "fat" but this is intended to change as readers +# requiring fat files often mishandle timestamps after 2037 anyway. # -DZIC_MAX_ABBR_LEN_WO_WARN=3 # (or some other number) to set the maximum time zone abbreviation length # that zic will accept without a warning (the default is 6) @@ -375,16 +382,10 @@ LEAPSECONDS= zic= ./zic ZIC= $(zic) $(ZFLAGS) -# Append "-b fat" to install larger TZif files that work around -# incompatiblities and bugs in some TZif readers, notably readers that -# mishandle 64-bit data in TZif files. Append "-b slim" to install -# smaller TZif files that test for these year-2038 bugs. If no -b -# option is given, the current default is "-b fat", but this is -# intended to change as buggy readers often mishandle timestamps -# after 2038 anyway. -# -# To shrink the size of installed TZif files even further, +# To shrink the size of installed TZif files, # append "-r @N" to omit data before N-seconds-after-the-Epoch. +# You can also append "-b slim" if that is not already the default; +# see ZIC_BLOAT_DEFAULT above. # See the zic man page for more about -b and -r. ZFLAGS= diff --git a/NEWS b/NEWS index 53c440c..76db493 100644 --- a/NEWS +++ b/NEWS @@ -53,9 +53,10 @@ Unreleased, experimental changes older software, notably software that mishandles 64-bit TZif data or uses obsolete TZ strings like "EET-2EEST" that lack DST rules. Slim format is more efficient and does not work around 64-bit bugs - or obsolete TZ strings. Currently zic defaults to fat format, - although this is intended to change in future zic versions, as the - buggy software often mishandles timestamps anyway. + or obsolete TZ strings. Currently zic defaults to fat format + unless you compile with -DZIC_BLOAT_DEFAULT=\"slim\"; this + out-of-the-box default is intended to change in future releases + as the buggy software often mishandles timestamps anyway. zic no longer treats a set of rules ending in 2037 specially. Previously, zic assumed that such a ruleset meant that future diff --git a/zic.c b/zic.c index 5da3ca4..8bf5628 100644 --- a/zic.c +++ b/zic.c @@ -659,6 +659,10 @@ want_bloat(void) return 0 <= bloat; } +#ifndef ZIC_BLOAT_DEFAULT +# define ZIC_BLOAT_DEFAULT "fat" +#endif + int main(int argc, char **argv) { @@ -791,6 +795,8 @@ _("%s: invalid time range: %s\n"), } if (optind == argc - 1 && strcmp(argv[optind], "=") == 0) usage(stderr, EXIT_FAILURE); /* usage message by request */ + if (bloat == 0) + bloat = strcmp(ZIC_BLOAT_DEFAULT, "slim") == 0 ? -1 : 1; if (directory == NULL) directory = TZDIR; if (tzdefault == NULL) -- 2.21.0
participants (1)
-
Paul Eggert