Ticket #4959 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

Timezone should come from /etc/sysconfig/clock

Reported by: cscott Owned by: erikos
Priority: normal Milestone: Update.1
Component: sugar Version:
Keywords: Cc: erikos, marco
Action Needed: Verified: no
Deployments affected: Blocked By:
Blocking:

Description

At the moment we have an /etc/timezone file, which is non-standard.

Bill Nottingham says, "What we do in 'normal' Fedora is we have /etc/sysconfig/clock that has a ZONE= line; when this is changed, tzdata-update is run. (tzdata-update is also run on tzdata upgrades.)"

That's what we should do, too.

Change History

  Changed 6 years ago by jg

  • owner changed from cscott to dgilmore
  • milestone changed from Never Assigned to Update.2

  Changed 6 years ago by cscott

  • owner changed from dgilmore to marco
  • component changed from distro to sugar
  • milestone changed from Update.2 to Update.1

This should be synchronized with sugar-control-panel.

  Changed 6 years ago by marco

  • owner changed from marco to erikos

  Changed 6 years ago by erikos

Sugar-control-panel actually looks for the /etc/sysconfig/clock. This is the file where we write the settings to when we change the timezone besides copying the correct timezone from /usr/share/zoneinfo/ to /etc/timezone. The sugar control panel's timezone feature was based on the system-config-date one.

Please close this ticket if this is the desired behavior.

  Changed 6 years ago by marco

  • owner changed from erikos to cscott

Back to cscott to verify it's what he wants and close the ticket.

  Changed 6 years ago by cscott

  • owner changed from cscott to erikos

Erikos: please remove the write to /etc/timezone; let's deprecate that and I'll remove it from pilgrim. Do you re-run tzdata-update after writing to /etc/sysconfig/clock ?

  Changed 6 years ago by marco

  • milestone changed from Update.1 to Retriage, Please!

It's unclear from the report what's the user visible problem.

follow-up: ↓ 9   Changed 6 years ago by cscott

My testing with joyride seems to indicate that 'sugar-control-panel -s timezone' doesn't work. Running it in a terminal, it complains, "Permission denied. You need to be root to run this method." When I "su -" to root, I get a traceback: "RuntimeError: The SUGAR_PATH environment variable is not set". So I couldn't confirm that tzdata-update is actually being called after we write to /etc/sysconfig/clock. Properly setting the timezone is, I believe, an update.1 item.

Additional issues uncovered: 1) No way to know what the valid time zones are. 2) My clock was incorrectly set and I saw no obvious way to reset it. 3) Although MP machines are supposed to have clocks set to GMT, anecdotal reports have been that they are set to China time instead. Can we workaround this, to minimize the necessity for (2)?

in reply to: ↑ 8   Changed 6 years ago by erikos

Replying to cscott:

My testing with joyride seems to indicate that 'sugar-control-panel -s timezone' doesn't work. Running it in a terminal, it complains, "Permission denied. You need to be root to run this method." When I "su -" to root, I get a traceback: "RuntimeError: The SUGAR_PATH environment variable is not set". So I couldn't confirm that tzdata-update is actually being called after we write to /etc/sysconfig/clock. Properly setting the timezone is, I believe, an update.1 item.

use su only. su - changes the environment.

Additional issues uncovered: 1) No way to know what the valid time zones are. 2) My clock was incorrectly set and I saw no obvious way to reset it. 3) Although MP machines are supposed to have clocks set to GMT, anecdotal reports have been that they are set to China time instead. Can we workaround this, to minimize the necessity for (2)?

Well we need to set the correct time first since timezone is an offset only. if people have network connection they can use rdate to get the clock correct.

  Changed 6 years ago by cscott

  • cc erikos, marco added
  • owner changed from erikos to cscott

OK, part of my problem was that I did 'su -' above, instead of just 'su'. But changing from su to sudo might break sugar-control-panel; I made a note in #5537 to ensure that SUGAR_PATH is preserved. Are there other environment variables which Sugar needs saved?

sugar-control-panel in joyride-1424 seems already not to write to /etc/timezone, so that file can probably be safely removed. I assume we're running tzdata-update correctly, as /etc/localtime seems to be updated after the write to /etc/sysconfig/clock.

In any case, it seems like the only remaining work on this ticket is getting rid of /etc/timezone in pilgrim. I opened #5561 for "no way to set clock" and #5562 for "no way to know what valid time zones are".

  Changed 6 years ago by cscott

tzdata-update is a terrifying piece of code! http://pastebin.ca/823971 from glibc-20070515T2025/fedora/tzdata-update.c

Nonetheless, it doesn't seem to be doing anything too fancy: it updates /var/spool/postfix/etc/localtime as well as /etc/localtime, takes care not to write to the file unless the time zone really as changed, and contains a lot of crap which looks to be present solely to avoid any dependency on glibc.

So I think it's perfectly safe to *not* use this monstrosity, and write /etc/localtime on our own.

  Changed 6 years ago by cscott

I opened #5563 to ensure that the time zone data is preserved across upgrades, and updated when the timezone database changes.

  Changed 6 years ago by cscott

Ok, joyride pilgrim has been patched to use /etc/sysconfig/clock instead of /etc/timezone. But see #5603. The machines come set to GMT from the factory, but if you set it to something else you can never reset it to GMT.

  Changed 6 years ago by cscott

  • owner changed from cscott to ApprovalForUpdate

This is a pilgrim patch; assign back to cscott after approval for commit to the update.1 pilgrim branch.

  Changed 6 years ago by jg

  • owner changed from ApprovalForUpdate to dgilmore
  • milestone changed from Retriage, Please! to Update.1

Approved.

  Changed 6 years ago by cscott

  • owner changed from dgilmore to cscott

  Changed 6 years ago by marco

Is this in yet?

  Changed 6 years ago by marco

  • component changed from sugar to distro

follow-up: ↓ 21   Changed 6 years ago by erikos

One part of the sugar-control-panel is missing. It is true that once you set to something else than GMT you can not set it back since s-c-p parses /usr/share/zoneinfo/zone.tab to get the available options which does not include GMT :/

  Changed 6 years ago by erikos

  • owner changed from cscott to erikos
  • component changed from distro to sugar

The rest of the fixes scott describes are working afaict.

in reply to: ↑ 19   Changed 6 years ago by cscott

  • status changed from new to closed
  • resolution set to fixed

Replying to erikos:

One part of the sugar-control-panel is missing. It is true that once you set to something else than GMT you can not set it back since s-c-p parses /usr/share/zoneinfo/zone.tab to get the available options which does not include GMT :/

You are describing #5603. I believe this bug can be closed.

Note: See TracTickets for help on using tickets.