Bug 14898 - ldb test_timestring and test_string_to_time failing on 32-bit architectures
Summary: ldb test_timestring and test_string_to_time failing on 32-bit architectures
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: AD: LDB/DSDB/SAMDB (show other bugs)
Version: 4.15.2
Hardware: Other All
: P5 major (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-09 20:27 UTC by Mathieu Parent
Modified: 2021-11-09 20:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Parent 2021-11-09 20:27:57 UTC
The new tests are failing on all 32-bit architecures.

With:

> =====================================================================
> ERROR: test_timestring (__main__.NoContextTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/<<PKGBUILDDIR>>/tests/python/api.py", line 47, in test_timestring
>     self.assertEqual("00000101000000.0Z", ldb.timestring(-62167219200))
> OverflowError: Python int too large to convert to C long
> 
> ======================================================================
> FAIL: test_string_to_time (__main__.NoContextTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/<<PKGBUILDDIR>>/tests/python/api.py", line 65, in test_string_to_time
>     self.assertEqual(-62167219200, ldb.string_to_time("00000101000000.0Z"))
> AssertionError: -62167219200 != -1

https://buildd.debian.org/status/logs.php?pkg=ldb&ver=2%3A2.2.3-1

Introduced by:

commit 71e8b24b8a031de26b21539e36a60f459257d2fd
Author: Stefan Metzmacher <metze@samba.org>
Date:   Tue Jan 19 16:53:55 2021 +0100

    pyldb: catch potential overflow error in py_timestring
    
    Pair-Programmed-With: Björn Baumbach <bb@sernet.de>
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Björn Baumbach <bb@sernet.de>
    Reviewed-by: Andrew Bartlett <abartlet@samba.org>


As said by Andrew in https://bugzilla.samba.org/show_bug.cgi?id=14558#c18:

> There isn't much that can be done except on hosts with 64-bit time_t and
> 32-bit long, where we could instead have python import a 64-bit number.