public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/5186] New: localtime does not handle changed /etc/localtime
@ 2007-10-16  7:02 adi at hexapodia dot org
  2007-10-16  8:02 ` [Bug libc/5186] " adi at hexapodia dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: adi at hexapodia dot org @ 2007-10-16  7:02 UTC (permalink / raw)
  To: glibc-bugs

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.

-- 
           Summary: localtime does not handle changed /etc/localtime
           Product: glibc
           Version: 2.3.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: adi at hexapodia dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5186

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-14  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-16  7:02 [Bug libc/5186] New: localtime does not handle changed /etc/localtime adi at hexapodia dot org
2007-10-16  8:02 ` [Bug libc/5186] " adi at hexapodia dot org
2007-10-17 20:23 ` drepper at redhat dot com
2007-12-14  9:09 ` dhinakaran dot k at lntemsys dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).