Comment 30 for bug 49068

Christian Assig (chrassig) wrote :

> It sounds like we need to divide this into two bugs. My problem has a
> lot more to do with the localtime/TZ situation.
I agree. Because of the title of this bug, I suggest we keep track of the time zone detection in this bug, and someone reports a new bug for the problem regarding deprecated time zone data in Java's time zone database.

> As far as the localtime/TZ situation, why not just handle it during the install of the jdk/jre?
Pretty simple: A lot of people have Ubuntu on their laptops and travel from time zone to time zone (like me e.g.). By just determining the time zone during the package installation, Java would not be updated once you change the time zone settings of the operating system, at least not until you install a new Java package.

> Determine if /etc/localtime is a link or not and warn the user that they need to copy over whatever localtime is linked to if they have a separate mount for /usr, or set TZ somewhere...
As described above, this does not work either. If you change /etc/localtime to a symbolic link during the installation of the Java package, it might be changed back by any program included in Ubuntu that makes any kind of changes to the time zone settings. If /etc/localtime is a regular file (that is the current situation), you may encounter the bug described here.

Some thoughts about Allen Crider's suggestions from 2007-05-05:

1. The time zone detection already checks if /etc/localtime is a regular file or a symbolic link, so why not make it check if the files in /usr/share/zoneinfo are regular files? Of course, this could cause trouble if someone decides to change all files in /usr/share/zoneinfo to symbolic links for some reason. Simply reading /etc/timezone if it exists would be my personal favourite.

2. Like I said before, I guess there are quite a lot of people using Ubuntu on laptops that change time zones quite often. So I think if you want to change the Ubuntu environment to make Sun's current implementation detect the time zone correctly, you will have to change all applications in Ubuntu that modify time zones to either set the environment variable TZ or to create /etc/sysconfig/clock as well. Setting TZ during boot time would not suffice, as you would have to reboot every time you change the time zone setting.

3. Very ugly, but it could work. Like I wrote before, you would have to put something like
export TZ=`cat /etc/timezone`
into the wrapper scripts for all java VM executables.

4. A Java VM is supposed to know the correct time and time zone, and it should not be the duty of any single Java based application to implement a workaround. So I guess this is just a workaround, not a bug fix at all.