[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#375978: marked as done (timezone variable not set correctly, bug blocking LSB Conformance)



Your message dated Sun, 11 Feb 2007 23:34:50 +0100
with message-id <20070211223450.GQ11573@hades.madism.org>
and subject line Close with versions
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.3.2.ds1-22sarge3

Problem: after calling the C method "ctime" the global variable "timezone" is not set correctly with certain TZ environment variables. With TZ=JKL3:10PNM4:40 set, the value of "timezone" is expected to be 11400, but has a nonsense value of 18000.

For a demonstration please see the attched file test.c

This is a libc bug (already in libc Bugzilla (see http://sourceware.org/bugzilla/show_bug.cgi?id=2865 )), but can be fixed in Debian.

This would be important for LSB compliance (LSB Runtime tests LSB runtime tests T.ctime_X 1, T.localtim_X 1, T.mktime_X 1).
LSB test failure message:
       with TZ=JKL3:10PNM4:40 ctime() did not set timezone correctly
       value of timezone was 18000, expected 11400

A patch for sarge is attached.

Kernel on tested system: 2.6.14-2-686-smp
libc version: 2.3.2.ds1-22sarge3


--
Martin Dittmar          Linux Information Systems AG
                        Fon +49 (0)30 72 62 38-15      Ehrenbergstr 19
mdittmar@linux-ag.com                                  D-10245 Berlin
The Migration Company. _______________________________ www.linux-ag.com
#! /bin/sh -e

# DP: Make __tzfile_default reset __use_tzfile = 0 before returning to tzset_internal

if [ $# -ne 2 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

--- glibc-2.3.2/time/tzfile.c.dist	2006-06-23 17:32:49.946051496 +0200
+++ glibc-2.3.2/time/tzfile.c	2006-06-23 17:36:12.606973832 +0200
@@ -439,6 +439,10 @@
   /* Set the timezone.  */
   __timezone = -types[0].offset;
 
+  /* since the user specified a hand-made timezone we dont claim to
+   * use tzfile further on */
+  __use_tzfile = 0;
+
   compute_tzname_max (stdlen + dstlen);
 }
 
#include        <string.h>
#include        <sys/types.h>
#include        <stdlib.h>
#include        <time.h>
#include        <limits.h>

extern int tz;
int set_tz(tzval) char *tzval;  {
	char    *tz;
        static char     buf[100];
	(void) strcpy(buf, "TZ=");
	(void) strcat(buf, tzval);

	putenv(buf);
        tz = getenv("TZ");
        if (tz == NULL || strcmp(tz, tzval) != 0)
        {
		printf("Error setting TZ!");
	}
}
			

int main() {
	
	printf("timezone at start of program:%ld \n",timezone);
	printf("running ctime with \"586185855L\" as time \n");
	time_t mytime = 586185855L;
	char * c = ctime(&mytime);
	printf("timezone:%ld\n",timezone);
	
	set_tz("JKL3:10");
	ctime(&mytime);
	printf("timezone with TZ=JKL3:10 :  %ld  \n",timezone);
	
	set_tz("PNM4:40");
	ctime(&mytime);
	printf("timezone with TZ=PNM4:40 :  %ld  \n",timezone);

	set_tz("JKL3:10PNM4:40");
	ctime(&mytime);
	printf("timezone with TZ=JKL3:10PNM4:40 (!!! expected 11400 !!!):  %ld\n",timezone);
	
}

--- End Message ---
--- Begin Message ---
Version: 2.3.6.ds1-10

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpjjWY2AGY4U.pgp
Description: PGP signature


--- End Message ---

Reply to: