-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_zipfile fails on AIX due to time.localtime #83683
Comments
Hi,
The PR associated to the new behavior is: #12726 (new on Python 3.8). Code is AIX specific. Is the code 32 bit only, or maybe the test was not updated? ----- I can reproduce the behavior as follow:
|
I suggest to skip the test if time.localtime() fails with OverflowError. Can you please try attached patch on AIX, on the master branch if possible? (Or on Python 3.8 at least.) |
Tested on Python 3.8.1 on both 32 and 64 bits. test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile) ... skipped 'time.localtime(4386268800) raises OverflowError' |
Good. I created PR 18282 from my patch. |
Probably this broke the 64-bit usage. diff --git a/Python/pytime.c b/Python/pytime.c -#ifdef _AIX
+#ifdef defined(_AIX) and (SIZEOF_LONG ==4)
/* bpo-34373: AIX does not return NULL if t is too small or too large */
if (t < -2145916800 /* 1902-01-01 */
|| t > 2145916800 /* 2038-01-01 */) { Testing... |
I'm not sure of the meaning of your patch. Are you saying that localtime() supports timestamp after the year 2038 on 64-bit AIX? Did you test that time.localtime(2**32) actually works as expected? In my timezone, Linux, I get: $ python3
Python 3.7.6 (default, Dec 19 2019, 22:52:49)
>>> import time; time.localtime(2**32)
time.struct_time(tm_year=2106, tm_mon=2, tm_mday=7, tm_hour=7, tm_min=28, tm_sec=16, tm_wday=6, tm_yday=38, tm_isdst=0) |
From memory I recall the 64-bit version worked with values above the threshold value that broke the 32-bit library. And the additional test was needed because the AIX library (iirc did not return NULL on error) - so had to test range before the call to get an overflow. Working up a test of 32 and 64-bit enviornments. |
I think it worked as expected before 3.8 on 64 bit. On AIX 64bit, with Python3.7.4, $ python3_64
Python 3.7.4 (default, Jan 15 2020, 15:46:22)
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
time.struct_time(tm_year=2106, tm_mon=2, tm_mday=7, tm_hour=7, tm_min=28, tm_sec=16, tm_wday=6, tm_yday=38, tm_isdst=0) and on 32bit $ python3_32
Python 3.7.4 (default, Jan 15 2020, 15:50:53)
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: timestamp out of range for platform time_t With the new Python 3.8.1, on both 32 and 64bits, Python 3.8.1 (default, Jan 30 2020, 11:23:14)
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: localtime argument out of range |
Even if localtime() is updated to support larger timestamp, this change is still needed for 32-bit AIX. |
Seems to be working on 64-bit, starting 32-bit test (with overflow expected). Once finished will post a PR. root@x065:[/data/prj/python/python3-3.9]./python
Python 3.9.0a3+ (heads/bpo-39502-dirty:8d49f7ceb4, Jan 30 2020, 14:47:52) [C] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
time.struct_time(tm_year=2107, tm_mon=1, tm_mday=27, tm_hour=9, tm_min=7, tm_sec=32, tm_wday=3, tm_yday=27, tm_isdst=0)
>>> time.gmtime(4325562452)
time.struct_time(tm_year=2107, tm_mon=1, tm_mday=27, tm_hour=9, tm_min=7, tm_sec=32, tm_wday=3, tm_yday=27, tm_isdst=0)
>>> |
test_time already has tests for timestamps after year 2038, no? |
OK. There have been some comments/questions re: PR18282. a) my PR is missing that PR, seems we just missed each other. b) when using my patch I took a suggestion from bpo-39460 to test again: root@x065:[/home/python/python3-3.9]./python -m test -v test_zipfile -m test_add_file_after_2107 --tempdir /tmp ---------------------------------------------------------------------- Ran 1 test in 0.257s OK == Tests result: SUCCESS == 1 test OK. Total duration: 653 ms Without the --tempdir setting it "skips" to PASS: root@x065:[/home/python/python3-3.9]./python -m test -v test_zipfile -m test_add_file_after_2107 ---------------------------------------------------------------------- Ran 1 test in 0.010s OK (skipped=1) == Tests result: SUCCESS == 1 test OK. Total duration: 252 ms FYI |
p.s., I manually added bpo-18282 to the test, and the results are the same as without - using 64-bit. Will rebuild the 32-bit and try test again. |
AIX kernel seems to have a bug. You should report it to AIX. >>> time.localtime(91301504)
time.struct_time(tm_year=1972, tm_mon=11, tm_mday=22, tm_hour=18, tm_min=31, tm_sec=44, tm_wday=2, tm_yday=327, tm_isdst=0) |
Not sure I understand what bug I am supposed to report. I apologize if I assume your comment re: time.localtime(91301504) comes from this bit Assuming our TZ used are different I am verifying AIX works correctly root@x065:[/data/prj/python/python3-3.9]./python
Python 3.9.0a3+ (heads/master-dirty:78c7183f47, Feb 3 2020, 14:10:40) [C] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.gmtime(91301504)
time.struct_time(tm_year=1972, tm_mon=11, tm_mday=22, tm_hour=17, tm_min=31, tm_sec=44, tm_wday=2, tm_yday=327, tm_isdst=0)
>>> time.localtime(91301504)
time.struct_time(tm_year=1972, tm_mon=11, tm_mday=22, tm_hour=17, tm_min=31, tm_sec=44, tm_wday=2, tm_yday=327, tm_isdst=0) root@x065:[/data/prj/python/python3-3.9]set | grep TZ Again, my apologies for the confusion: the message When I specify --tempdir=/tmp (i.e., using jfs2 as filesystem) the test passes normally. On 03/02/2020 09:40, STINNER Victor wrote:
> STINNER Victor <vstinner@python.org> added the comment:
>
>> test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile) ... skipped 'Linux VFS/XFS kernel bug detected: mtime_ns=91301504000000000'
> AIX kernel seems to have a bug. You should report it to AIX.
>
>>>> time.localtime(91301504)
> time.struct_time(tm_year=1972, tm_mon=11, tm_mday=22, tm_hour=18, tm_min=31, tm_sec=44, tm_wday=2, tm_yday=327, tm_isdst=0)
>
>
|
I think that Victor means AIX kernel and filesystems are not prepared for Y2038. |
Does time.gmtime() accept year after 2038 on 64-bit AIX? Example on Linux: >>> time.gmtime(4386268800)
time.struct_time(tm_year=2108, tm_mon=12, tm_mday=30, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=6, tm_yday=365, tm_isdst=0) |
My apologies for the late reply - Here is 3.6.10: Python 3.6.10 (default, Mar 24 2020, 14:12:31) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.gmtime(4386268800)
time.struct_time(tm_year=2108, tm_mon=12, tm_mday=30, tm_hour=0,
tm_min=0, tm_sec=0, tm_wday=6, tm_yday=365, tm_isdst=0) And, a patched 3.9: root@x064:[/data/prj/python/python-3.9]./python
Python 3.9.0a4+ (default, Mar 13 2020, 08:03:36) [C] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.gmtime(4386268800)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: timestamp out of range for platform time_t So, it should be working - but is not after the patches. I'll work on an On 07/02/2020 18:57, STINNER Victor wrote:
> STINNER Victor <vstinner@python.org> added the comment:
>
> Does time.gmtime() accept year after 2038 on 64-bit AIX? Example on Linux:
>
>>>> time.gmtime(4386268800)
> time.struct_time(tm_year=2108, tm_mon=12, tm_mday=30, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=6, tm_yday=365, tm_isdst=0)
>
>
|
Is there anything left to do here? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: