Patchwork Force rereading TZDEFRULES after it was used to set DST rules only (bug #19253)

login
register
mail settings
Submitter Andreas Schwab
Date Nov. 17, 2015, 10:56 a.m.
Message ID <mvmsi44uc5w.fsf@hawking.suse.de>
Download mbox | patch
Permalink /patch/9694/
State New
Headers show

Comments

Andreas Schwab - Nov. 17, 2015, 10:56 a.m.
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.

Andreas.

	[BZ #19253]
	* time/tzfile.c (__tzfile_default): Invalidate tzfile attribute
	cache when TZDEFRULES was used.
---
 time/tzfile.c | 6 ++++++
 1 file changed, 6 insertions(+)
Joseph Myers - Nov. 17, 2015, 11 a.m.
Is there some reason it's hard to add a test for this to the testsuite?
Andreas Schwab - Nov. 17, 2015, 11:09 a.m.
Joseph Myers <joseph@codesourcery.com> writes:

> Is there some reason it's hard to add a test for this to the testsuite?

It depends on TZDEFRULES on the host.

Andreas.

Patch

diff --git a/time/tzfile.c b/time/tzfile.c
index 57abbb8..0e581f2 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