changeset 3027:908f1fb82dd8

RH995488: Java thinks that the default timezone is Busingen instead of Zurich 2013-09-05 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: (ICEDTEA_PATCHES): Add new patch. * patches/rh995488-rhel_tz_fix.patch: Use /etc/sysconfig/clock on RHEL & clones so that they don't search /usr/share/zoneinfo. * NEWS: Mention patch.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Fri, 06 Sep 2013 12:19:02 +0100
parents 4c400be792d3
children b1c024eed215
files ChangeLog Makefile.am NEWS patches/rh995488-rhel_tz_fix.patch
diffstat 4 files changed, 89 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 20 17:49:21 2013 +0000
+++ b/ChangeLog	Fri Sep 06 12:19:02 2013 +0100
@@ -1,3 +1,12 @@
+2013-09-05  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	* Makefile.am:
+	(ICEDTEA_PATCHES): Add new patch.
+	* patches/rh995488-rhel_tz_fix.patch:
+	Use /etc/sysconfig/clock on RHEL & clones
+	so that they don't search /usr/share/zoneinfo.
+	* NEWS: Mention patch.
+
 2013-09-02  Andrew John Hughes  <gnu.andrew@redhat.com>
 
 	* NEWS: Add missing backport entries.
--- a/Makefile.am	Wed Nov 20 17:49:21 2013 +0000
+++ b/Makefile.am	Fri Sep 06 12:19:02 2013 +0100
@@ -732,7 +732,8 @@
 	patches/openjdk/6980281-majorver_for_solaris.patch \
 	patches/openjdk/7000225-bad_tabs.patch \
 	patches/openjdk/7038711-fix_no-clobber_usage.patch \
-	patches/disable-cc-incompatible-sanity-checks.patch
+	patches/disable-cc-incompatible-sanity-checks.patch \
+	patches/rh995488-rhel_tz_fix.patch
 
 if WITH_RHINO
 ICEDTEA_PATCHES += \
--- a/NEWS	Wed Nov 20 17:49:21 2013 +0000
+++ b/NEWS	Fri Sep 06 12:19:02 2013 +0100
@@ -42,6 +42,7 @@
   - S8020983, RH976897: OutOfMemoryError caused by non garbage collected JPEGImageWriter Instances
 * Bug fixes
   - PR1188: ASM Interpreter and Thumb2 JIT javac miscompile modulo reminder on armel.
+  - RH995488: Java thinks that the default timezone is Busingen instead of Zurich
 
 New in release 1.12.6 (2013-07-10):
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/rh995488-rhel_tz_fix.patch	Fri Sep 06 12:19:02 2013 +0100
@@ -0,0 +1,77 @@
+diff --git a/src/solaris/native/java/util/TimeZone_md.c b/src/solaris/native/java/util/TimeZone_md.c
+--- openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
++++ openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
+@@ -52,6 +52,8 @@
+ #ifdef __linux__
+ 
+ static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
++static const char *REDHAT_RELEASE_FILE = "/etc/redhat-release";
++static const char *SYSCONFIG_CLOCK_FILE = "/etc/sysconfig/clock";
+ static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
+ static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
+ 
+@@ -225,6 +227,64 @@
+     }
+ 
+     /*
++     * Next, try the ZONE entry in /etc/sysconfig/clock.
++     */
++    if ((fp = fopen(REDHAT_RELEASE_FILE, "r")) != NULL) {
++	char id[7];
++
++	/* Avoid this file on Fedora as may be buggy; RH489586 */
++	if (fgets(id, sizeof (id), fp) != NULL && 
++	  strncmp(id, "Fedora", 6) != 0) {
++	    (void) fclose(fp);
++	    if ((fp = fopen(SYSCONFIG_CLOCK_FILE, "r")) != NULL) {
++		char line[256];
++		
++		while (fgets(line, sizeof(line), fp) != NULL) {
++		    char *p = line;
++		    char *s;
++		    
++		    SKIP_SPACE(p);
++		    if (*p != 'Z') {
++			continue;
++		    }
++		    if (strncmp(p, "ZONE=\"", 6) == 0) {
++			p += 6;
++		    } else {
++			/*
++			 * In case we need to parse it token by token.
++			 */
++			if (strncmp(p, "ZONE", 4) != 0) {
++			    continue;
++			}
++			p += 4;
++			SKIP_SPACE(p);
++			if (*p++ != '=') {
++			    break;
++			}
++			SKIP_SPACE(p);
++			if (*p++ != '"') {
++			    break;
++			}
++		    }
++		    for (s = p; *s && *s != '"'; s++)
++			;
++		    if (*s != '"') {
++			/* this ZONE entry is broken. */
++			break;
++		    }
++		    *s = '\0';
++		    tz = strdup(p);
++		    break; 
++		}
++		(void) fclose(fp);
++		if (tz != NULL) {
++		    return tz;
++		}
++	    }
++	}
++    }
++
++    /*
+      * Next, try /etc/localtime to find the zone ID.
+      */
+     if (lstat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) {