Hide Forgot
Description of problem: os.lstat() returns negative values for owner and/or group for users with huge UID/GIDs on i386 arch while on other archs it is positive as expected and on i386 also libuser returns positive values. This is not a regression. Version-Release number of selected component (if applicable): python-2.6.6-20.el6.i686 python-2.6.5-3.el6_0.2.i686 How reproducible: always Steps to Reproduce: 1. # adduser -u 4294967293 foo 2. # python >>> import os >>> os.lstat('/home/foo/') 3. Actual results: Negative UID -> st_uid=-3: >>> os.lstat('/home/foo/') posix.stat_result(st_mode=16832, st_ino=523265L, st_dev=64770L, st_nlink=4, st_uid=-3, st_gid=506, st_size=4096L, st_atime=1303126993, st_mtime=1303126936, st_ctime=1303126936) Expected results: Unchanged UID value -> st_uid=4294967293: >>> os.lstat('/home/foo/') posix.stat_result(st_mode=16832, st_ino=16, st_dev=64771L, st_nlink=2, st_uid=4294967293, st_gid=502, st_size=1024, st_atime=1303126860, st_mtime=1303126860, st_ctime=1303126860) Additional info: The issue is causing failures in s-c-users on i386 systems when reproducing bug https://bugzilla.redhat.com/show_bug.cgi?id=628730 but it might have also other negative implications.
*** Bug 697472 has been marked as a duplicate of this bug. ***
Relevant code is within Modules/posixmodule.c: 1291 static PyObject* 1292 _pystat_fromstructstat(STRUCT_STAT *st) 1293 { ... 1313 PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st->st_uid)); 1314 PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st->st_gid)); ... A PyIntObject can only hold a C "long" type, whereas as PyLongObject can hold an arbitrary-sized integer value. Appears to still affect latest upstream 2.7 maintenance branch. (Python 3 upstream uses PyLong_FromLong((long)st->st_uid) so may or may not be affected)
Looks similar to this upstream bug: http://bugs.python.org/issue4591
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2011-1564.html