Running "2.3.6.ds1-8" from Debian unstable on x86_64, libc does not seem to correctly update its idea of localtime when /etc/localtime changes. adi@xxxxx:~/tmp$ cat localtime-relink.c #include <time.h> #include <stdio.h> #include <stdlib.h> int main(void) { char b1[40], b2[40]; time_t t; struct tm tm1, tm2; system("ln -snf /usr/share/zoneinfo/PST8PDT /etc/localtime"); system("ls -l /etc/localtime"); t = 1192516347; strftime(b1, sizeof(b1), "%F %T %Z", localtime_r(&t, &tm1)); system("ln -snf /usr/share/zoneinfo/EST5EDT /etc/localtime"); system("ls -l /etc/localtime"); t = 1192516347; strftime(b2, sizeof(b2), "%F %T %Z", localtime_r(&t, &tm2)); printf("b1 = %s\n", b1); printf("b2 = %s\n", b2); return 0; } adi@xxxxx:~/tmp$ cc -Wall -g localtime-relink.c adi@xxxxx:~/tmp$ sudo ./a.out lrwxrwxrwx 1 root root 27 2007-10-15 23:56 /etc/localtime -> /usr/share/zoneinfo/PST8PDT lrwxrwxrwx 1 root root 27 2007-10-16 02:56 /etc/localtime -> /usr/share/zoneinfo/EST5EDT b1 = 2007-10-15 23:32:27 PDT b2 = 2007-10-15 23:32:27 PDT Note that the ls output does have the proper timezone offset, but the two calls to localtime_r return the same 'struct tm' values. Inspecting with gdb shows that all fields are the same.
(In reply to comment #0) > Running "2.3.6.ds1-8" from Debian unstable on x86_64, libc does not seem to > correctly update its idea of localtime when /etc/localtime changes. Note that this is reproducable even with an empty environment. adi@xxxxx:~/tmp$ sudo env -i env adi@xxxxx:~/tmp$ sudo env -i ./a.out lrwxrwxrwx 1 root root 27 Oct 16 01:00 /etc/localtime -> /usr/share/zoneinfo/PST8PDT lrwxrwxrwx 1 root root 27 Oct 16 04:00 /etc/localtime -> /usr/share/zoneinfo/EST5EDT b1 = 2007-10-15 23:32:27 PDT b2 = 2007-10-15 23:32:27 PDT
Your test case is wrong since localtime_r does not have to (nor should) implicitly call tzset. That's necessary to enable parallelism. But there was a problem with using localtime after a file change. This is now fixed.
Drepper, (In reply to comment #2) > Your test case is wrong since localtime_r does not have to (nor should) > implicitly call tzset. That's necessary to enable parallelism. > But there was a problem with using localtime after a file change. This is now > fixed. Looks like, its a problem with localtime() even. Can I know, from which version on, localtime() can handle change in /etc/localtime. Thanks dhina