Bug 102974

Summary: Changing timezone breaks /etc/localtime perms so UTC time is displayed instead
Product: [Retired] Red Hat Linux Reporter: Tim Garlick <garlick>
Component: redhat-config-dateAssignee: Brent Fox <bfox>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: rahul
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-03-11 15:00:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tim Garlick 2003-08-24 00:23:44 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
When travelling, I like to change my timezone to the local timezone.  
The bug is that when you run redhat-config-date as root, it updates
/etc/localtime and changes the permissions to 600.  Ordinary users can no longer
read the file so all dates are displayed in UTC (unless you are root).  You have
to chmod /etc/localtime to 644 and then logout and back in again to get Clock,
'date', etc to display correctly.

Version-Release number of selected component (if applicable):
redhat-config-date-1.5.15-1

How reproducible:
Always

Steps to Reproduce:
Here is the process I use to do this and the resulting bug:

1. Using Clock 2.2.0.1 in my gnome panel, I right-click and go to "Adjust Date &
Time..." 

2. I'm prompted for the root password.

3. redhat-config-date starts and I select the new timezone. I am also using ntp,
so the "Enable NTP" box is checked.  

4. Click Okay, and the ntp server is contacted and then redhat-config-date
exits.  The Clock applet does not change to the local timezone.

5. Run the 'date' command and note that the date is displayed in UTC, not the
old or new timezone.

6. Logging out and back in again causes the Clock applet to display the time in UTC.

Actual Results:  The date is displayed in UTC.

Expected Results:  The date should have been displayed in the local timezone.

Additional info:

Comment 1 Brent Fox 2003-08-28 21:14:53 UTC
I'm confused.  At first, you are talking about the file permissions on
/etc/localtime getting changed to 600.  I am not able to reproduce this behavior
with redhat-config-date-1.5.15-2.  For me, the ownership never changes from 644.


Comment 2 Brent Fox 2003-10-14 22:18:09 UTC
Resolving as 'worksforme'.

Comment 3 Radu Cornea 2003-10-23 15:58:01 UTC
I am having the same problem with both redhat-config-date-1.5.15-1 and
redhat-config-date-1.5.15-2. Only for root the 'date' command returns the time
in PDT, regular users get the UTC version. The permissions on /etc/localtime are
wrong (600).


Comment 4 Rahul Karnik 2003-10-30 13:03:03 UTC
I can confirm this bug. Changing /etc/localtime to 644 solves the problem.
System is fully updated to rawhide as of 10/29/2003.

Comment 5 Benny Amorsen 2003-11-11 09:33:33 UTC
The problem is that /etc/localtime is created by redhat-config-date
without changing permissions. If the umask is 022, no problem, but if
the umask is 077, /etc/localtime does not get read permissions.

When creating files, please do not rely on the umask. This time it was
luckily not a security problem, just a loss of functionality. Unless
the umask is 000, but nobody is that stupid.

(I can't reopen this bug since I'm not the submitter.)

Comment 6 Tim Garlick 2003-11-11 16:35:22 UTC
I am re-opening this bug.  I didn't think of the umask, but I'm not
making my umask be less secure just so I can change the date when I
travel.  I have learned to just chmod /etc/localtime as root when I
get to a new timezone, but it would be a lot better for
redhat-config-date to set the permissions explicitly.

Comment 7 Brent Fox 2004-03-11 15:00:10 UTC
The following code in timezoneBackend.py should force the umask on
/etc/localtime to be 644:

	try:
	    os.chmod("/etc/localtime", 0644)
	except OSError, (errno, msg):
	    print (_("Changing permission of timezone: %s") % (msg))

Please reopen this bug if you see this behavior with
system-config-date-1.7.2-1 in Rawhide.