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 774304 - Cover relative path in /etc/localtime symlink
Cover relative path in /etc/localtime symlink
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Calendar
3.22.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-calendar-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2016-11-11 23:21 UTC by Stephen
Modified: 2017-01-10 08:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test.c (26.72 KB, text/plain)
2016-12-19 13:43 UTC, Milan Crha
Details

Description Stephen 2016-11-11 23:21:15 UTC
As of today, on Evolution 3.22.1/GNOME 3.22.1 on Fedora 25, with a system (GNOME) time zone of London, Evolution detects it as Europe/Jersey (as shown in Evolution preferences and in the event creation dialogue).
Comment 1 Milan Crha 2016-11-29 09:41:12 UTC
Thanks for a bug report. Could you check what /etc/localtime looks like, please? I guess it's not a soft link, in which case the timezone is clear, but otherwise at the worst case a file compare is done and the first file with the same content "wins".

>   $ ls -l /etc/localtime
>   .... /etc/localtime -> ../usr/share/zoneinfo/Europe/London
Comment 2 Stephen 2016-11-29 12:07:35 UTC
It is a soft link:

$ ls -l /etc/localtime 
lrwxrwxrwx. 1 root root 35 Apr 26  2013 /etc/localtime -> ../usr/share/zoneinfo/Europe/London
Comment 3 Milan Crha 2016-11-29 14:58:51 UTC
Weird, it looks quite the same as here. I even tried from scratch, replacing the file with this:

   # ln -s /usr/share/zoneinfo/Europe/London /etc/localtime

and it made it work properly, which means that the next start of the evolution the Europe/London had been shown in Edit->Preferences->Calendar and Tasks.
Comment 4 Stephen 2016-12-17 12:14:40 UTC
What do you want me to do to pinpoint the cause?
Comment 5 Milan Crha 2016-12-19 13:43:45 UTC
Created attachment 342217 [details]
test.c

Maybe a libical version you use can be the cause. At least I had such experience with the development version of it. Anyway, the attached test.c contains a comment at the top with the command line to use to compile and execute it. The code below it is the same as the one used by the evolution, only with added debugging prints. You might need to install glib2-devel and libical-devel to be able to compile the code.

It prints what timezones had been detected, then it shows how it found out the timezone it discovered, also with the location of it. Please run it, and let me know the result of it. No need to copy whole output of the run, enough might be lines which will mention your timezone location. Thanks in advance.
Comment 6 Stephen 2017-01-09 14:29:15 UTC
Relevant output:

system_timezone_read_etc_localtime_softlink: file:'../usr/share/zoneinfo/Europe/London' to tz:'(null)'
   system_timezone_is_valid: failed, tz is NULL
system_timezone_read_etc_timezone: 
   system_timezone_is_valid: failed, tz is NULL
system_timezone_read_etc_sysconfig_clock: 
   system_timezone_is_valid: failed, tz is NULL
system_timezone_read_etc_sysconfig_clock_alt: 
   system_timezone_is_valid: failed, tz is NULL
system_timezone_read_etc_TIMEZONE: 
   system_timezone_is_valid: failed, tz is NULL
system_timezone_read_etc_rc_conf: 
   system_timezone_is_valid: failed, tz is NULL
system_timezone_read_etc_conf_d_clock: 
   system_timezone_is_valid: failed, tz is NULL
system_timezone_read_etc_localtime_content: 
   system_timezone_is_valid: tz:'Europe/Jersey' is valid
main: found location:'Europe/Jersey'

Problem is that the /etc/localtime symlink is to a relative rather than absolute path then, with a leading '..', and e-cal-system-timezone.c  doesn't canonicalise the symlink path before testing with g_str_has_prefix (filename, SYSTEM_ZONEINFODIR "/")
Comment 7 Stephen 2017-01-09 14:32:14 UTC
Just tested, and switching the time zone via GNOME Control Centre time zone map results in similar relative symlinks, i.e. ../usr/share/zoneinfo/[time zone]
Comment 8 Milan Crha 2017-01-09 18:14:56 UTC
Ah, what a detail, relative path. I didn't notice it until you pointed into it. Thanks a lot for the investigation.
Comment 9 Milan Crha 2017-01-09 18:37:24 UTC
I didn't find any function to convert a relative path to an absolute path, thus I just special-cased the relative path existence.

Created commit 1874bc3 in eds master (3.23.4+)
Created commit 6aa5bfc in eds gnome-3-22 (3.22.4+)
Comment 10 Stephen 2017-01-09 18:45:15 UTC
realpath() in stdlib?
Comment 11 Milan Crha 2017-01-10 08:18:41 UTC
Thanks for the pointer. I've been looking for GLib wrapper, just to have something portable (which the stdlib should be, I know). Anyway, the above change is sufficient, at least for now, thus I'll keep it as it is.