]> Savannah Git Hosting - gnulib.git/commitdiff
Port better to CentOS 5
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Nov 2017 22:30:25 +0000 (14:30 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Nov 2017 23:04:15 +0000 (15:04 -0800)
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
doc/glibc-functions/strverscmp.texi
doc/posix-functions/tzset.texi
tests/test-nstrftime.c

index ae669d48a1acca83ebdbd5b60a4ffcbd65eabcb2..a1cb692450179cb5122a0380166963f574bb636f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index c3fc7bea6a56aefe2d783d73bcbc07d486e36104..7974ff9cf1cdaecf24c1cc54a82cc36ca57e6d23 100644 (file)
@@ -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
+@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
index 2e16cb4a083bef9b71db9c034c649edf98c55604..1ba3941898404a4966d470a170cc1938529e1906 100644 (file)
@@ -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.
+@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
index e01ac789221e5e34191b5418534cfac2b0b4799c..ef3958a11ebf895c4ef6a1427333dbcade731e75 100644 (file)
 
 #include <errno.h>
 #include <stdio.h>
-#include <time.h>
 #include <string.h>
+#include <time.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 @@ 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 }
   };