changeset 39174:79703e533448

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.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 28 Nov 2017 14:30:25 -0800
parents bd8aa1175bdf
children 4e93dc94ca06
files ChangeLog doc/glibc-functions/strverscmp.texi doc/posix-functions/tzset.texi tests/test-nstrftime.c
diffstat 4 files changed, 31 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 28 14:19:55 2017 -0800
+++ b/ChangeLog	Tue Nov 28 14:30:25 2017 -0800
@@ -1,5 +1,17 @@
 2017-11-28  Paul Eggert  <eggert@cs.ucla.edu>
 
+	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.
--- a/doc/glibc-functions/strverscmp.texi	Tue Nov 28 14:19:55 2017 -0800
+++ b/doc/glibc-functions/strverscmp.texi	Tue Nov 28 14:30:25 2017 -0800
@@ -13,4 +13,11 @@
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+On older glibc platforms, this function does not always properly treat
+digit strings with leading zeros as fractions (for example,
+@code{strverscmp ("B0075022800016.gbp.corp.com",
+"B007502357019.GBP.CORP.COM")} does not yield a negative number as it
+should):
+glibc 2.9
 @end itemize
--- a/doc/posix-functions/tzset.texi	Tue Nov 28 14:19:55 2017 -0800
+++ b/doc/posix-functions/tzset.texi	Tue Nov 28 14:30:25 2017 -0800
@@ -28,4 +28,7 @@
 @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.
+@item
+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
--- a/tests/test-nstrftime.c	Tue Nov 28 14:19:55 2017 -0800
+++ b/tests/test-nstrftime.c	Tue Nov 28 14:30:25 2017 -0800
@@ -22,12 +22,16 @@
 
 #include <errno.h>
 #include <stdio.h>
+#include <string.h>
 #include <time.h>
-#include <string.h>
+#include <unistd.h>
 
 #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 @@
     { 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 }
   };