Java and timezone issues!

David M. Karr davidmichaelkarr at
Mon Apr 20 16:37:46 UTC 2009

Derek Broughton wrote:
> David M. Karr wrote:
>> The two packages that got installed this morning were "tzdata" and
>> "tzdata-java", one of which (or the installation process itself) changed
>> /etc/localtime from a link to a hard file.  What's odd is that the
>> "installed files list" for either package does not list
>> "/etc/localtime".  
> It's not odd - I explained it in my first post to this thread, and I thought
> you'd read it, since you responded.

I don't know what specific post you're referring to.

>> However, I suppose if something tried to replace the 
>> file that "/etc/localtime" was symlinked to, the process of doing that
>> might leave "/etc/localtime" as a plain copy of the original
>> symlinked-to file.  
> No.

I don't know how it's doing it, I just know from a very simple 
experiment that it is.  Just before I installed the tzdata update a 
couple of days ago, I looked at the file.  It was a symlink.  I 
installed the tzdata update.  It was now a plain file.

>> The "tzdata" package had 
>> "/usr/share/zoneinfo/US/Pacific" in its installed files list, which is
>> the file /etc/localtime is supposed to be symlinked to.
> It's _not_ supposed to be symlinked.

I'm sure you're right.  The symlink is a workaround for the broken 
timezone detection process in Java.  It's apparently been used so much 
some people assumed it was supposed to be that way.

>> If I'm guessing correctly about what happens when a file is moved on top
>> of a file that is symlinked-to, then changing /etc/localtime from a
>> symlink to a plain file may be completely inadvertent.
> Try it.  You replace the destination file, not the link.  That's why I
> suggested it could be very bad for you to replace a file that _should_ be a
> real file with a symlink.

Yes, I did try it.  I found no "accidental" way to make a symlink become 
a plain file with contents identical to the originally linked-to file. 
As /etc/localtime isn't in the file list of either of those packages, I 
have no idea how or why the process changes it, whether or not it's 
supposed to be a link.

More information about the ubuntu-users mailing list