After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664237 - GDateTime falls back to UTC if TZ is set
GDateTime falls back to UTC if TZ is set
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-11-16 23:56 UTC by Giovanni Campagna
Modified: 2012-02-06 19:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtimezone: consider a leading : in TZ environment variable (1.37 KB, patch)
2011-11-16 23:56 UTC, Giovanni Campagna
none Details | Review
gtimezone: consider a leading : in TZ environment variable (1.69 KB, patch)
2011-11-17 17:31 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2011-11-16 23:56:15 UTC
Everytime TZ is set, GDateTime (actually GTimeZone) fails to retrieve the zoneinfo file and falls back to UTC.
Patch following.
Comment 1 Giovanni Campagna 2011-11-16 23:56:41 UTC
Created attachment 201565 [details] [review]
gtimezone: consider a leading : in TZ environment variable

When set to represent a zoneinfo file, TZ must start with :, therefore
glib must ignore the first char when building the resulting filename,
or it won't be found.
Comment 2 Allison Karlitskaya (desrt) 2011-11-17 09:25:29 UTC
In fact, there's this:

http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html

This should be what we aim for.

glibc does a good job of doing things not in this spec (for example, it allows TZ=America/Toronto directly, with no ':').  I'd like not to exclude these cases as well, since people are probably likely to set their TZ variable based on what they see glibc allowing.
Comment 3 Giovanni Campagna 2011-11-17 17:31:04 UTC
Created attachment 201604 [details] [review]
gtimezone: consider a leading : in TZ environment variable

When set to represent a zoneinfo file, TZ may start with :, therefore
glib needs to check it and ignore the first char when building the
resulting filename, or it won't be found.
Also, the path could be absolute, in which case it is wrong to
append /usr/share/timezone
Comment 4 Giovanni Campagna 2012-02-06 15:48:00 UTC
Almost 3 months later, any review on this (just to get it off my inbox)?
Comment 5 Allison Karlitskaya (desrt) 2012-02-06 18:22:19 UTC
Review of attachment 201604 [details] [review]:

Sorry that this fell off the radar.
Comment 6 Giovanni Campagna 2012-02-06 19:29:48 UTC
Attachment 201604 [details] pushed as 1faed13 - gtimezone: consider a leading : in TZ environment variable