>From 33a6f35094dc4f572bf65c701d5cffa8d0c1ea27 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 28 Nov 2017 14:30:25 -0800 Subject: [PATCH] Port better to CentOS 5 Problems reported by Tom G. Christensen in: https://lists.gnu.org/r/bug-gnulib/2017-11/msg00053.html * doc/glibc-functions/strverscmp.texi (strverscmp): Document strverscmp bug with glibc 2.9 and earlier. * doc/posix-functions/tzset.texi (tzset): Document that TZ with angle brackets is POSIX-2001 and later. * tests/test-nstrftime.c: Include unistd.h. (TZ_ANGLE_BRACKETS_SHOULD_WORK): New macro. (TZ): Use it to skip tests with angle brackets in TZ, for older systems. --- ChangeLog | 12 ++++++++++++ doc/glibc-functions/strverscmp.texi | 7 +++++++ doc/posix-functions/tzset.texi | 3 +++ tests/test-nstrftime.c | 12 +++++++++--- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae669d48a..a1cb69245 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2017-11-28 Paul Eggert + Port better to CentOS 5 + Problems reported by Tom G. Christensen in: + https://lists.gnu.org/r/bug-gnulib/2017-11/msg00053.html + * doc/glibc-functions/strverscmp.texi (strverscmp): + Document strverscmp bug with glibc 2.9 and earlier. + * doc/posix-functions/tzset.texi (tzset): + Document that TZ with angle brackets is POSIX-2001 and later. + * tests/test-nstrftime.c: Include unistd.h. + (TZ_ANGLE_BRACKETS_SHOULD_WORK): New macro. + (TZ): Use it to skip tests with angle brackets in TZ, + for older systems. + stat: add missing module dependencies * modules/lstat, modules/stat, modules/utimensat (Depends-on): Add stat-time. diff --git a/doc/glibc-functions/strverscmp.texi b/doc/glibc-functions/strverscmp.texi index c3fc7bea6..7974ff9cf 100644 --- a/doc/glibc-functions/strverscmp.texi +++ b/doc/glibc-functions/strverscmp.texi @@ -13,4 +13,11 @@ Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX Portability problems not fixed by Gnulib: @itemize address@hidden +On older glibc platforms, this function does not always properly treat +digit strings with leading zeros as fractions (for example, address@hidden ("B0075022800016.gbp.corp.com", +"B007502357019.GBP.CORP.COM")} does not yield a negative number as it +should): +glibc 2.9 @end itemize diff --git a/doc/posix-functions/tzset.texi b/doc/posix-functions/tzset.texi index 2e16cb4a0..1ba394189 100644 --- a/doc/posix-functions/tzset.texi +++ b/doc/posix-functions/tzset.texi @@ -28,4 +28,7 @@ support for @code{tz} database settings like @code{TZ='America/New_York'}. Even this subset does not work on applications built via the Universal Windows Platform, as it does not make environment variables like @env{TZ} available to applications. address@hidden +Older POSIX platforms do not support angle brackets in @env{TZ} values, +as this feature was added in IEEE Std 1003.1-2001. @end itemize diff --git a/tests/test-nstrftime.c b/tests/test-nstrftime.c index e01ac7892..ef3958a11 100644 --- a/tests/test-nstrftime.c +++ b/tests/test-nstrftime.c @@ -22,12 +22,16 @@ #include #include -#include #include +#include +#include #include "macros.h" #define STREQ(a, b) (strcmp (a, b) == 0) +/* Support for settings like TZ='<+00>0' was added in IEEE Std 1003.1-2001. */ +#define TZ_ANGLE_BRACKETS_SHOULD_WORK (200112 <= _POSIX_VERSION) + struct posixtm_test { time_t in; @@ -123,21 +127,23 @@ static struct localtime_rz_test LT[] = { TZ+CentEur, 0, "1970-01-01 01:00:00 +0100 (CET)", 0 }, { TZ+Japan , 0, "1970-01-01 09:00:00 +0900 (JST)", 0 }, { TZ+NZ , 0, "1970-01-01 13:00:00 +1300 (NZDT)", 1 }, - { TZ+Unknown, 0, "1970-01-01 00:00:00 -0000 (-00)", 0 }, { TZ+Pacific, 500000001, "1985-11-04 16:53:21 -0800 (PST)", 0 }, { TZ+Arizona, 500000001, "1985-11-04 17:53:21 -0700 (MST)", 0 }, { TZ+UTC , 500000001, "1985-11-05 00:53:21 +0000 (UTC)", 0 }, { TZ+CentEur, 500000001, "1985-11-05 01:53:21 +0100 (CET)", 1 }, { TZ+Japan , 500000001, "1985-11-05 09:53:21 +0900 (JST)", 0 }, { TZ+NZ , 500000001, "1985-11-05 13:53:21 +1300 (NZDT)", 0 }, - { TZ+Unknown, 500000001, "1985-11-05 00:53:21 -0000 (-00)", 0 }, { TZ+Pacific, 1000000002, "2001-09-08 18:46:42 -0700 (PDT)", 0 }, { TZ+Arizona, 1000000002, "2001-09-08 18:46:42 -0700 (MST)", 0 }, { TZ+UTC , 1000000002, "2001-09-09 01:46:42 +0000 (UTC)", 0 }, { TZ+CentEur, 1000000002, "2001-09-09 03:46:42 +0200 (CEST)", 0 }, { TZ+Japan , 1000000002, "2001-09-09 10:46:42 +0900 (JST)", 0 }, { TZ+NZ , 1000000002, "2001-09-09 13:46:42 +1200 (NZST)", 0 }, +#if TZ_ANGLE_BRACKETS_SHOULD_WORK + { TZ+Unknown, 0, "1970-01-01 00:00:00 -0000 (-00)", 0 }, + { TZ+Unknown, 500000001, "1985-11-05 00:53:21 -0000 (-00)", 0 }, { TZ+Unknown, 1000000002, "2001-09-09 01:46:42 -0000 (-00)", 0 }, +#endif { 0 } }; -- 2.14.3