Bug 123101 - ZONE is not used for anything
Summary: ZONE is not used for anything
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-date
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nils Philippsen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-05-12 14:43 UTC by Kaj J. Niemi
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-10-07 11:27:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
script to set system timezone based on ZONE variable in /etc/sysconfig/clock (10.18 KB, text/plain)
2004-12-12 03:25 UTC, James Valente
no flags Details

Description Kaj J. Niemi 2004-05-12 14:43:01 UTC
Description of problem:
It looks like ZONE set in /etc/sysconfig/clock is not really used by
any init scripts. This leads down a fun trail of chasing a problem
which shouldn't really exist. It turns out that the authorative file
for the system time zone is actually /etc/localtime. Manual
replacement is required in case the time zone changes on a particular
system. It would be nicer if the value from ZONE was used to copy the
timezone file to /etc when starting up.

How reproducible:
Always

Steps to Reproduce:
1. Install system in America/New_York
2. reboot
3. change /etc/sysconfig/clock to Europe/Amsterdam
4. reboot
5. date
  
Actual results:
Wed May 12 10:40:04 EDT 2004

Expected results:
Wed May 12 16:40:19 CEST 2004

Additional info:

Comment 1 Bill Nottingham 2004-05-21 21:00:28 UTC
ZONE is written by the config tools as a marker of their last state,
actually.

Comment 2 Kaj J. Niemi 2004-06-01 09:59:50 UTC
Hmmh, I was more thinking of unattended installations. For example if
I kickstart about 20-100 systems at one time and then need to change
the system tz on each and everyone of them by copying to
/etc/localtime by hand it gets a bit tedious. ;-)

Would you consider including a simple patch to initscripts which
checks if the string defined in ZONE is a valid file in the
/usr/share/timezone/ directory and copies it to /etc/localtime?

I guess there might be a chicken and a egg problem since the localtime
is probably set before /usr is being mounted..?

Comment 3 Bill Nottingham 2004-06-01 16:15:16 UTC
Exactly; that's why it's a copy and not a symlink in the first place. :/

Comment 4 James Valente 2004-12-12 03:25:33 UTC
Created attachment 108393 [details]
script to set system timezone based on ZONE variable in /etc/sysconfig/clock

I noticed this same problem in Fedora Core 1.  Some of the sysadmins at my
company were updating the ZONE variable in the clock file, thinking this would
set the system's timezone upon reboot, but it was not.	A search throughout the
init scripts confirmed this.  To resolve it, I wrote a new script that can be
called automatically at system startup or manually at anytime the superuser
wishes.

The script tries to make appropriate guesses as to what the system's correct
timezone should be, based on either the ZONE variable in /etc/sysconfig/clock
or the /etc/localtime file.  If the ZONE variable is valid, it prefers that. 
If ZONE is invalid or not set, then the script uses /etc/localtime and updates
the ZONE variable in the clock file.  If localtime is a symlink to a valid zone
file, then use that time zone.	If locatime is not a symlink, then the script
uses MD5 hash to find the matching zone file under /usr/share/zoneinfo. 
Finally, the script optionally emails errors, warnings, information, and debug
messages to an email address specified.

The approach I take in my script is to symlink /etc/localtime to the
appropriate zone file under /usr/share/zoneinfo.  That may or may not be
desirable behavior, but it works for me.  If not the desired behavior, then the
line "ln -s $ZONEFILE $LOCALTIME" can be rewritten as "cp -f $ZONEFILE
$LOCALTIME"

Comment 5 Bill Nottingham 2005-09-30 21:21:01 UTC
Moving to s-c-date; it's probably best for it to comment when it writes the file
that that is not the authoritative setting.

Comment 6 Nils Philippsen 2005-10-07 11:27:48 UTC
Fixed in system-config-date-1.7.99.2.


Note You need to log in before you can comment on or make changes to this bug.