[PROPOSED 0/9] Fixes for Casey and for portability
Most of these fixes are so that ‘make check’ passes, or improve commentary. The more noticeable changes are to the Antarctica/Casey data (where there’s a good chance we’re still wrong but at least we’re more in sync with timeanddate.com), along with code portability fixes for FreeBSD and OpenBSD. Paul Eggert (9): Distribute new file checknow.awk too Fix ‘make check_character_set’ false positive Update tzselect comment for Solaris 10 EOL * checknow.awk: Fix typo in empty-input diagnostic. Port ‘make check_now’ to macOS Pacify FreeBSD 14 c99 Sync Casey data from timeanddate.com Port localtime.c timeoff to OpenBSD 7.4 * NEWS: Mention a few more post-2023c changes. Makefile | 27 ++++++++++++++++----------- NEWS | 13 +++++++++++++ antarctica | 12 +++++++++++- checknow.awk | 3 ++- localtime.c | 3 +++ private.h | 4 +--- tzselect.ksh | 2 +- 7 files changed, 47 insertions(+), 17 deletions(-) -- 2.43.0
* Makefile (AWK_SCRIPTS, VERSION_DEPS): Add checknow.awk. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f473af67..cc5af634 100644 --- a/Makefile +++ b/Makefile @@ -588,7 +588,7 @@ TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds $(ZONETABLES) -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ +AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ ziguard.awk zishrink.awk MISC= $(AWK_SCRIPTS) TZS_YEAR= 2050 @@ -609,7 +609,7 @@ VERSION_DEPS= \ calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ africa antarctica asctime.c asia australasia \ backward backzone \ - checklinks.awk checktab.awk \ + checklinks.awk checknow.awk checktab.awk \ date.1 date.c difftime.c \ etcetera europe factory iso3166.tab \ leap-seconds.list leapseconds.awk localtime.c \ -- 2.43.0
The false positive occurs on Solaris 10 when $(UTF_LOCALE) does not work. * Makefile (UTF8_LOCALE_MISSING): New macro. (check_character_set, check_white_space): Use it. (check_white_space): Simplify two ‘grep’s into one. --- Makefile | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index cc5af634..4e45f93b 100644 --- a/Makefile +++ b/Makefile @@ -829,11 +829,16 @@ check_mild: check_character_set check_white_space check_links \ check_slashed_abbrs check_sorted \ check_tables check_web check_ziguard check_zishrink check_tzs +# True if UTF8_LOCALE does not work; +# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). +UTF8_LOCALE_MISSING = \ + { test ! '$(UTF8_LOCALE)' \ + || ! printf 'A\304\200B\n' \ + | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ + || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } + check_character_set: $(ENCHILADA) - test ! '$(UTF8_LOCALE)' || \ - ! printf 'A\304\200B\n' | \ - LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ - LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + $(UTF8_LOCALE_MISSING) || { \ sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ @@ -848,12 +853,12 @@ check_character_set: $(ENCHILADA) touch $@ check_white_space: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ - ! grep -En "$$pat" \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - ! grep -n '[$s]$$' \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - touch $@ + ! grep -En "$$pat|[$s]\$$" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ + } + touch $@ PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} -- 2.43.0
* tzselect.ksh: Solaris 10 EOL has been extended to January 2027. See: https://blogs.oracle.com/solaris/post/new-end-date-of-extended-support-for-o... --- tzselect.ksh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tzselect.ksh b/tzselect.ksh index 70bda9c0..2073bccd 100644 --- a/tzselect.ksh +++ b/tzselect.ksh @@ -21,7 +21,7 @@ REPORT_BUGS_TO=tz@iana.org # MirBSD Korn Shell <http://www.mirbsd.org/mksh.htm> # # For portability to Solaris 10 /bin/sh (supported by Oracle through -# January 2025) this script avoids some POSIX features and common +# January 2027) this script avoids some POSIX features and common # extensions, such as $(...), $((...)), ! CMD, unquoted ^, ${#ID}, # ${ID##PAT}, ${ID%%PAT}, and $10. Although some of these constructs # work sometimes, it's simpler to avoid them entirely. -- 2.43.0
--- checknow.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checknow.awk b/checknow.awk index 51ee998f..e50ad118 100644 --- a/checknow.awk +++ b/checknow.awk @@ -28,7 +28,7 @@ BEGIN { zone = $3 data = zone_data[zone] if (!data) { - printf "%s: no data\n" + printf "%s: no data\n", zone status = 1 } else { zone2 = zonenow[data] -- 2.43.0
* checknow.awk: Port to macOS, where ‘find FOO/’ outputs names containing ‘FOO//’. --- checknow.awk | 1 + 1 file changed, 1 insertion(+) diff --git a/checknow.awk b/checknow.awk index e50ad118..d722c03f 100644 --- a/checknow.awk +++ b/checknow.awk @@ -15,6 +15,7 @@ BEGIN { record_zone(zone, data) zone = $0 sub(/.*\.dir\//, "", zone) + sub(/\/\//, "/", zone) sub(/"/, "", zone) data = "" } else if ($0 ~ /./) -- 2.43.0
* private.h (HAVE__GENERIC): Do not #define to 1 merely because __has_extension(c_generic_selections) is true. This pacifies ‘c99’ on FreeBSD 14, which diagnoses uses of _Generic even if protected by ‘#if __has_extension(c_generic_selections)’. --- private.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/private.h b/private.h index 08fea8c0..52e8b1f5 100644 --- a/private.h +++ b/private.h @@ -74,9 +74,7 @@ #endif #if !defined HAVE__GENERIC && defined __has_extension -# if __has_extension(c_generic_selections) -# define HAVE__GENERIC 1 -# else +# if !__has_extension(c_generic_selections) # define HAVE__GENERIC 0 # endif #endif -- 2.43.0
* NEWS: Mention this. * antarctica (Antarctica/Casey): Add five zone changes since 2020. --- NEWS | 5 +++++ antarctica | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 5f8df64e..9d0341d0 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ Unreleased, experimental changes Briefly: Ittoqqortoormiit, Greenland changes time zones on 2024-03-31. Vostok, Antarctica changed time zones on 2023-12-18. + Casey, Antarctica changed time zones five times since 2020. Code and data fixes for Palestine timestamps starting in 2072. A new data file zonenow.tab for timestamps starting now. @@ -25,6 +26,10 @@ Unreleased, experimental changes Vostok, Antarctica changed to +05 on 2023-12-18. It had been at +07 (not +06) for years. (Thanks to Zakhary V. Akulov.) + Change data for Casey, Antarctica to agree with timeanddate.com, + by adding five time zone changes since 2020. Casey is now at +08 + instead of +11. + Changes to past tm_isdst flags Much of Greenland, represented by America/Nuuk, changed its diff --git a/antarctica b/antarctica index 9931378b..763c2725 100644 --- a/antarctica +++ b/antarctica @@ -80,6 +80,11 @@ # - 2018 Oct 7 4:00 - 2019 Mar 17 3:00 - 2019 Oct 4 3:00 - 2020 Mar 8 3:00 # and now - 2020 Oct 4 0:01 +# From Paul Eggert (2023-12-20): +# Transitions from 2021 on are taken from: +# https://www.timeanddate.com/time/zone/antarctica/casey +# retrieved at various dates. + # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 @@ -93,7 +98,12 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2019 Oct 4 3:00 11:00 - +11 2020 Mar 8 3:00 8:00 - +08 2020 Oct 4 0:01 - 11:00 - +11 + 11:00 - +11 2021 Mar 14 0:00 + 8:00 - +08 2021 Oct 3 0:01 + 11:00 - +11 2022 Mar 13 0:00 + 8:00 - +08 2022 Oct 2 0:01 + 11:00 - +11 2023 Mar 9 3:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb -- 2.43.0
* localtime.c (timeoff): Define to my_timeoff if timeoff should be static, to avoid colliding with <time.h>'s extern decl for timeoff in OpenBSD 7.4. --- localtime.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/localtime.c b/localtime.c index 1aee054f..c2cebfde 100644 --- a/localtime.c +++ b/localtime.c @@ -2293,6 +2293,9 @@ timelocal(struct tm *tmp) return mktime(tmp); } #else +# ifndef timeoff +# define timeoff my_timeoff /* Don't collide with OpenBSD 7.4 <time.h>. */ +# endif static #endif /* This function is obsolescent and may disapper in future releases. -- 2.43.0
--- NEWS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 9d0341d0..59b604b9 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,11 @@ Unreleased, experimental changes DST was in effect before the transition too. (Thanks to Alois Treindl for debugging help.) + localtime.c's timeoff no longer collides with OpenBSD 7.4. + + The C code now uses _Generic only if __STDC_VERSION__ says the + compiler is C11 or later. + tzselect now optionally reads zonenow.tab, to simplify when configuring only for timestamps dated from now on. @@ -85,6 +90,9 @@ Unreleased, experimental changes * It no longer uses its own 'cc' in place of CC. * It now uses ARFLAGS, with default specified by POSIX. * It does not use LFLAGS incompatibly with POSIX. + * It uses the special .POSIX target. + * It quotes special characters more carefully. + * It no longer mishandles builds in an ISO 8859 locale. Due to the CC changes, TZDIR is now #defined in a file tzfile.h built by 'make', not in a $(CC) -D option. Also, TZDEFAULT is now treated like TZDIR as they have similar roles. -- 2.43.0
participants (1)
-
Paul Eggert