This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.22-661-gc83196b


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  c83196b0df4340209f260ffaf90e787c711c268e (commit)
      from  97ee300903cdc0a0052d09ed7c3f7779a303d625 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c83196b0df4340209f260ffaf90e787c711c268e

commit c83196b0df4340209f260ffaf90e787c711c268e
Author: Andreas Schwab <schwab@suse.de>
Date:   Tue Nov 17 11:43:49 2015 +0100

    Force rereading TZDEFRULES after it was used to set DST rules only (bug #19253)
    
    If the TZDEFRULES file was used to set the DST rules when $TZ didn't
    provide any we need to make sure that the next time it is used we
    recompute everything as __tzfile_default changes some setting from what is
    provided by TZDEFRULES.

diff --git a/ChangeLog b/ChangeLog
index 5392b11..600c3dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-01-11  Andreas Schwab  <schwab@suse.de>
+
+	[BZ #19253]
+	* time/tzfile.c (__tzfile_default): Invalidate tzfile attribute
+	cache when TZDEFRULES was used.
+	* time/tst-tzname.c: New file.
+	* time/Makefile (test): Add tst-tzname.
+	(tst-tzname-ENV, CPPFLAGS-tst-tzname.c): Define.
+	* timezone/Makefile (test-zones): Add $(posixrules-file).
+	($(testdata)/$(posixrules-file)): New rule.
+
 2016-01-10  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Fix doc quoting problems with Texinfo 5
diff --git a/time/Makefile b/time/Makefile
index 912b0e0..e052c07 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -37,7 +37,8 @@ aux :=	    era alt_digit lc-time-cleanup
 tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
 	   tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
 	   tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
-	   tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime
+	   tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \
+	   tst-tzname
 
 include ../Rules
 
@@ -63,4 +64,7 @@ CFLAGS-test_time.c = -Wno-format
 tst-getdate-ENV= DATEMSK=datemsk TZDIR=${common-objpfx}timezone/testdata
 test_time-ARGS= EST5EDT CST
 
+tst-tzname-ENV = TZDIR=${common-objpfx}timezone/testdata
+CPPFLAGS-tst-tzname.c = -DTZDEFRULES='"$(posixrules-file)"'
+
 bug-getdate1-ARGS = ${objpfx}bug-getdate1-fmt
diff --git a/time/tst-tzname.c b/time/tst-tzname.c
new file mode 100644
index 0000000..ea7ec92
--- /dev/null
+++ b/time/tst-tzname.c
@@ -0,0 +1,50 @@
+/* Test that tzset sets tzname correctly (BZ #19253).
+   Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+  setenv ("TZ", TZDEFRULES, 1);
+  tzset ();
+  const char *stdtz = strdup (tzname[0]);
+  setenv ("TZ", "STD-1DST", 1);
+  tzset ();
+  if (strcmp (tzname[0], "STD") != 0)
+    {
+      printf ("FAIL: TZ=STD-1DST, tzname[0] = %s\n", tzname[0]);
+      result = 1;
+    }
+  setenv ("TZ", TZDEFRULES, 1);
+  tzset ();
+  if (strcmp (tzname[0], stdtz) != 0)
+    {
+      printf ("FAIL: TZ=%s, tzname[0] = %s\n", TZDEFRULES, tzname[0]);
+      result = 1;
+    }
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/time/tzfile.c b/time/tzfile.c
index 992806d..9049878 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -628,6 +628,12 @@ __tzfile_default (const char *std, const char *dst,
   __timezone = -types[0].offset;
 
   compute_tzname_max (stdlen + dstlen);
+
+  /* Invalidate the tzfile attribute cache to force rereading
+     TZDEFRULES the next time it is used.  */
+  tzfile_dev = 0;
+  tzfile_ino = 0;
+  tzfile_mtime = 0;
 }
 
 void
diff --git a/timezone/Makefile b/timezone/Makefile
index e6a6a08..dee7568 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -40,7 +40,8 @@ ifeq ($(run-built-tests),yes)
 # List zones generated by separate commands running zic on the host.
 # Each such zic run counts as a separate test.
 test-zones := America/New_York Etc/UTC UTC Europe/Berlin \
-	      Australia/Melbourne America/Sao_Paulo Asia/Tokyo
+	      Australia/Melbourne America/Sao_Paulo Asia/Tokyo \
+	      $(posixrules-file)
 tests-special += $(addprefix $(testdata)/, $(test-zones))
 endif
 
@@ -91,6 +92,8 @@ zic-deps = $(objpfx)zic $(leapseconds) yearistype
 
 $(testdata)/America/New_York: northamerica $(zic-deps)
 	$(build-testdata)
+$(testdata)/$(posixrules-file): $(testdata)/America/New_York
+	$(make-link); $(evaluate-test)
 $(testdata)/Etc/UTC: etcetera $(zic-deps)
 	$(build-testdata)
 # Use a pattern rule to indicate the command produces both targets at once.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                   |   11 +++++++++
 time/Makefile                               |    6 ++++-
 math/tst-definitions.c => time/tst-tzname.c |   31 ++++++++++++++-------------
 time/tzfile.c                               |    6 +++++
 timezone/Makefile                           |    5 +++-
 5 files changed, 42 insertions(+), 17 deletions(-)
 copy math/tst-definitions.c => time/tst-tzname.c (63%)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]