public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adi at hexapodia dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/5186] New: localtime does not handle changed /etc/localtime
Date: Tue, 16 Oct 2007 07:02:00 -0000	[thread overview]
Message-ID: <20071016070225.5186.adi@hexapodia.org> (raw)

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.


             reply	other threads:[~2007-10-16  7:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-16  7:02 adi at hexapodia dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071016070225.5186.adi@hexapodia.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).