Bugzilla – Bug 14548
glibc (2.7?) overwrites /etc/localtime
Last modified: 2008-10-15 10:44:12 UTC
$ sorcery -v 1.14.1-rc2 $ gaze version glibc Grimoire Section Spell Grimoire Version Installed Version -------- ------- ----- ---------------- ----------------- stable libs glibc 2.7 2.7 $ ls -lah /etc/localtime lrwxrwxrwx 1 root root 30 Jun 25 11:51 /etc/localtime -> /usr/share/zoneinfo/US/Pacific # cast -c glibc glibc preparing environment... [[ As you are running a 2.6 kernel, would you like to use the new nptl (Native Posix Thread Libary)? -> y ]] [[ Would you like to compile glibc with libidn support? -> y ]] glibc checking dependencies... glibc has a dependency on autoconf glibc has a dependency on gcc glibc has a dependency on gettext glibc has a dependency on gnupg glibc has a dependency on perl glibc has a dependency on smgl-fhs glibc has a dependency on smgl-archspecs glibc has a disabled optional dependency on libselinux glibc has a dependency on libidn glibc checking for reverse triggers... glibc triggers a cast_self on apr Run the trigger? [y] n glibc triggers a cast_self on e2fsprogs Run the trigger? [y] n glibc triggers a cast_self on locale Run the trigger? [y] n glibc triggers a cast_self on util-linux Run the trigger? [y] n autoconf No work to do. ... Collating dependencies... Spells are to be cast: --------------------------- glibc ... $ ls -lah /etc/localtime lrwxrwxrwx 1 root root 29 Jun 25 18:22 /etc/localtime -> ../usr/share/zoneinfo/Factory This did not use to happen with glibc and does not happen with glibc 2.6, but I've only noticed my time resetting recently.
Mine: $ ls -lah /etc/localtime -rw-r--r-- 1 root root 1.9K 2007-11-01 15:28 /etc/localtime $ gaze activity | grep 20071101.*glibc 20071101:1356(+0000) summon glibc 2.7 success 20071101:1356(+0000) cast glibc 2.7 start 20071101:1425(+0000) dispel glibc 2.6.1 success 20071101:1429(+0000) cast glibc 2.7 success So I guess I can confirm it, except that it isn't a link here (anymore?).
My box: $ ls -lah /etc/localtime lrwxrwxrwx 1 root root 33 2007-04-21 12:49 /etc/localtime -> /usr/share/zoneinfo/Europe/Prague It is a link from 2007-04-21. I updated glibc to 2.7 on 2007-11-12. No changes. $ gaze activity | grep glibc.*2.7 20071112:0143(+0000) summon glibc 2.7 success 20071112:0153(+0000) cast glibc 2.7 start 20071112:0214(+0000) cast glibc 2.7 success 20080411:0647(+0000) summon glibc 2.7 success 20080411:0647(+0000) cast glibc 2.7 start 20080411:0703(+0000) dispel glibc 2.7 success 20080411:0706(+0000) cast glibc 2.7 success 20080611:1139(+0000) summon glibc 2.7 success 20080611:1139(+0000) cast glibc 2.7 start 20080611:1154(+0000) dispel glibc 2.7 success 20080611:1158(+0000) cast glibc 2.7 success What about "gaze from /etc/localtime"? My is from install iso. $ cat /etc/sourcemage-release Source Mage GNU/Linux 0.9.6.3 i486-pc-linux-gnu Installed from CD using installer v. 0.9.6.3 on Sat Apr 21 12:49:50 CEST 2007
$ gaze from /etc/localtime $ No owners for /etc/localtime on my box. $ cat /etc/sourcemage-release Source Mage GNU/Linux 0.9.6.1 i486-pc-linux-gnu Installed from CD using installer v. 0.9.6.1 on Fri Feb 23 17:44:19 UTC 2007 $ cat /etc/sourcemage-release Source Mage GNU/Linux 0.9.5 i486-pc-linux-gnu Installed from CD using installer v. 0.9.5 on Sat Nov 12 19:26:36 PST 2005 And one from the x86_64 silverthistle release (no /etc/sourcemage-release).
$ gaze from /etc/localtime $ more /etc/sourcemage-release Source Mage GNU/Linux 0.9.5-test2 i486-pc-linux-gnu Installed from CD using installer v. 0.9.5-test2 on Sun Sep 25 16:13:17 CEST 2005 btw, $ strings -n 3 /etc/localtime | grep '^[[:alpha:]]\+$' this meantions CET and CEST, which are good for me. Maybe glibc copied the locales over instead of linking them?
On the a box installed from the following ISO: $ cat /etc/sourcemage-release Source Mage GNU/Linux 0.9.6.3 i486-pc-linux-gnu Installed from CD using installer v. 0.9.6.3 on Wed Jan 9 04:46:16 PST 2008 This also happens.
I have not yet found *why* this is happening. According to the code I've found in glibc, it should not be overwriting /etc/localtime: $ ls -lah /etc/localtime lrwxrwxrwx 1 root root 30 2008-06-27 13:19 /etc/localtime -> /usr/share/zoneinfo/US/Pacific $ ls -lah /usr/share/zoneinfo/US/Pacific -rw-r--r-- 2 root root 2.8K 2008-06-27 13:12 /usr/share/zoneinfo/US/Pacific $ if test -r /etc/localtime; then echo true; else echo false; fi true # cast -c glibc ... $ ls -lah /etc/localtime lrwxrwxrwx 1 root root 30 2008-06-27 13:19 /etc/localtime -> /usr/share/zoneinfo/Factory $ gaze compile glibc ... if test -r /etc/localtime; then \ echo Site timezone NOT reset to Factory.; \ else \ rm -f /etc/localtimeT; \ /bin/sh ../scripts/rellns-sh /usr/share/zoneinfo/Factory /etc/localtimeT; \ mv -f /etc/localtimeT /etc/localtime; \ if test -r /etc/localtime; then \ echo Site timezone NOT reset to Factory.; \ else \ rm -f /etc/localtimeT; \ /bin/sh ../scripts/rellns-sh /usr/share/zoneinfo/Factory /etc/localtimeT; \ mv -f /etc/localtimeT /etc/localtime; \ fi fi glibc-2.7/Makeconfig: # What timezone should be the installed default (e.g., US/Eastern). # Run `make -C time echo-zonenames' to see a list of available zone names. # The local timezone can be changed with `zic -l TIMEZONE' at any time. ifndef localtime localtime = Factory endif # Where to install the "localtime" timezone file; this is the file whose # contents $(localtime) specifies. If this is a relative pathname, it is # relative to $(zonedir). It is a good idea to put this somewhere # other than there, so the zoneinfo directory contains only universal data, # localizing the configuration data elsewhere. ifndef localtime-file localtime-file = $(sysconfdir)/localtime inst_localtime-file = $(install_root)$(localtime-file) endif glibc-2.7/timezone/Makefile: ifdef localtime $(installed-localtime-file): $(inst_zonedir)/$(localtime) $(objpfx)zic \ $(+force) $(make-target-directory) if test -r $@; then \ echo Site timezone NOT reset to Factory.; \ else \ rm -f $@T; \ $(SHELL) $(..)scripts/rellns-sh $< $@T; \ mv -f $@T $@; \ fi endif
Found a simple fix, testing now. Will commit and submit a bug upstream if it works.
Created attachment 7140 [details] Check if /etc/localtime is a symlink as well This patch modifies timezone/Makefile to also check if /etc/localtime is a symlink, and if so to NOT reset to Factory. I tested this with multiple recasts, with and without castfs, and /etc/localtime remained untouched.
Fixed in test with commit 83a63a9a73da1e33d4c02c052fe2457c32ca00c7
Requesting integration to stable-rc-0.26 and stable-0.25.
Upstream bug filed at http://sources.redhat.com/bugzilla/show_bug.cgi?id=6959
approving for stable-rc. Some more testing can't hurt and stable is around the corner anyway. Integrated.