Bug 1236619

Summary: java-1.6.0-openjdk reads and interprets /etc/sysconfig/clock
Product: Red Hat Enterprise Linux 6 Reporter: Paulo Andrade <pandrade>
Component: java-1.6.0-openjdkAssignee: Andrew John Hughes <ahughes>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: low Docs Contact:
Priority: low    
Version: 6.6CC: ahughes, baitken, dbhole, dkutalek, jvanek, mkolbas, tlavigne
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: java-1.6.0-openjdk-1.6.0.36-1.13.8.0.el6_7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 20:30:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paulo Andrade 2015-06-29 14:47:05 UTC
I was unsure if the problem was in system-config-date,
that does a "s/_/ /" in the string before writing to
/etc/sysconfig/clock, and appears to also do a "s/ /_/"
when reading it, in certain versions.

But I found a similar problem for Fedora from some
years ago, and that should have been corrected in
openjdk and sun java.

See https://bugzilla.redhat.com/show_bug.cgi?id=489586

Comment 2 Andrew John Hughes 2015-06-29 16:30:37 UTC
This has regressed because of bug #995488; see https://bugzilla.redhat.com/show_bug.cgi?id=995488#c21

On RHEL 6:

$ cat /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="Asia/Hong Kong"

$ /usr/lib/jvm/java-1.6.0-openjdk.x86_64/bin/java TestRH489586
Default TZ=sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
Now=Mon Jun 29 16:20:58 GMT 2015

$ /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/java TestRH489586
Default TZ=sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
Now=Mon Jun 29 16:21:01 GMT 2015

Correcting the space:

$ cat /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="Asia/Hong_Kong"

$ /usr/lib/jvm/java-1.6.0-openjdk.x86_64/bin/java TestRH489586
Default TZ=sun.util.calendar.ZoneInfo[id="Asia/Hong_Kong",offset=28800000,dstSavings=0,useDaylight=false,transitions=71,lastRule=null]
Now=Tue Jun 30 00:22:02 HKT 2015

$ /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/java TestRH489586
Default TZ=sun.util.calendar.ZoneInfo[id="Asia/Hong_Kong",offset=28800000,dstSavings=0,useDaylight=false,transitions=71,lastRule=null]
Now=Tue Jun 30 00:22:05 HKT 2015

OpenJDK 8 ignores the file, providing my local timezone (GB-Eire) in both cases.
So, presumably it suffers from bug #995488.

We could make the code in 6 & 7 replace the spaces with '_'. But I still think the correct fix is to provide /etc/timezone.

Comment 3 Andrew John Hughes 2015-06-29 16:53:41 UTC
I've filed bug 1236667 to try and get /etc/timezone supported, but we can try and support the space-variant in the meantime.

Comment 9 errata-xmlrpc 2016-05-10 20:30:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0788.html