[Python-Dev] Vacation and possibly a new bug

Kurt B. Kaiser kbk@shore.net
Thu, 24 Jul 2003 23:51:14 -0400


Stuart Bishop <zen@shangri-la.dropbear.id.au> writes:

> On Wednesday, July 23, 2003, at 08:42  AM, Neal Norwitz wrote:
>
>>
>> The patch below fixes test_time on RedHat 6.2/Alpha.  Since I don't
>> understand the code, I haven't the slighest clue if the patch is
>> correct or not.  But I do know what (365 * 24 * 3600) is.  :-)
>> I don't know what ((365 * 24 + 6) * 3600) is supposed to represent.
>> 1 year + 6 hours in seconds.  What's that?
>>
>> I've copied Stuart Bishop on this message as I believe he wrote
>> all this code. The patches in http://python.org/sf/762934 haven't
>> made the tests pass.
>
> I'm following this thread (from an out of sync timezone).

[...]

> bcannon's tzset_AEST.diff patch can be improved (it doesn't check if the
> system believes the whole year is entirely in DST). It also needs to
> do the following:
>
> time_t midyear = xmas - (365 * 24 * 3600 / 2);
>
> if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
>      exit(1);
>
> I'll make a patch when anon-cvs gets back up, unless someone beats
> me to it.

Further testing on RH Linux 6.2 and a revised patch:

[kbk@float ~/PYSRC]$ ./python
Python 2.3c2 (#15, Jul 24 2003, 11:17:16) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time    
>>> from os import environ
>>> victoria = 'AEST-10AEDT-11,M10.5.0,M3.5.0'
>>> environ['TZ'] = victoria
>>> time.tzset()
>>> time.tzname
('AEST', 'AEST')
>>>
===========================================================
Hm!!  Try a couple of things to try to see what's going on:
===========================================================
>>> victoria2 = 'AEST-10AEDT-11'
>>> environ['TZ'] = victoria2
>>> time.tzset()
>>> time.tzname
('AEST', 'AEDT')
>>>
>>> # try reversing the changeover
... 
>>> victoria3 = 'AEST-10AEDT-11,M3.5.0,M10.5.0'
>>> environ['TZ'] = victoria3
>>> time.tzset()
>>> time.tzname
('AEST', 'AEDT')
 
===================================
ok, debug inittimezone:
===================================
Breakpoint 1, inittimezone (m=0x4014053c)
    at /home/kbk/PYTHON/python/dist/src/Modules/timemodule.c:608
608			t = (time((time_t *)0) / YEAR) * YEAR;
(gdb) n
609			p = localtime(&t);
(gdb) p asctime(localtime(&t))
$14 = 0x4013be00 "Wed Jan  1 16:00:00 2003\n"
(gdb) p localtime(&t)->tm_zone
$19 = 0x8162b78 "AEST"

[std time on Jan 1!! ...back up a day or so....]

(gdb) p t = t - 84000
$20 = 1041316800
(gdb) p localtime(&t)->tm_zone
$21 = 0x8162b90 "AEDT"
(gdb) p asctime(localtime(&t))
$22 = 0x4013be00 "Tue Dec 31 17:40:00 2002\n"
(gdb) 

=============================================================
so Linux6.2 thinks AEDT switches to AEST in Jan, and six months
forward is still AEST.

xmas2002 is AEDT so config test passes but timemodule uses Jan 1
and flubs when setting tzname.

Need to do the config test later than xmas.
==============================================================

****** Apply Patch SF 762934  configure.in.patch.kbk *******

=============================================
autoreconf && ./configure && make clean && make OPT=-g

==============================================
extract from configure log:
....
checking for broken nice()... yes
checking for working tzset()... no
checking for tv_nsec in struct stat... no
checking whether mvwdelch is an expression... yes
....
=============================================

[kbk@float ~/PYSRC]$ ./python
Python 2.3c2 (#18, Jul 24 2003, 22:40:09) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from test import test_time
>>> test_time.test_main()
test_asctime (test.test_time.TimeTestCase) ... ok
test_clock (test.test_time.TimeTestCase) ... ok
test_conversions (test.test_time.TimeTestCase) ... ok
test_data_attributes (test.test_time.TimeTestCase) ... ok
test_sleep (test.test_time.TimeTestCase) ... ok
test_strftime (test.test_time.TimeTestCase) ... ok
test_strptime (test.test_time.TimeTestCase) ... ok
test_tzset (test.test_time.TimeTestCase) ... ok

----------------------------------------------------------------------
Ran 8 tests in 2.523s

OK
>>> 

================================================
make test:
================================================
....
....
test_zlib
227 tests OK.
28 tests skipped:
    test_aepack test_al test_bsddb185 test_bsddb3 test_cd test_cl
    test_curses test_email_codecs test_gl test_imgfile test_largefile
    test_linuxaudiodev test_macfs test_macostools test_nis
    test_normalization test_ossaudiodev test_pep277 test_plistlib
    test_scriptpackages test_socket_ssl test_socketserver
    test_sunaudiodev test_timeout test_unicode_file test_urllibnet
    test_winreg test_winsound
Those skips are all expected on linux2.
[kbk@float ~/PYSRC]$ 


-- 
KBK