Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 697470

Summary: os.lstat() returns negative values for owner and/or group for huge UID/GIDs on i386
Product: Red Hat Enterprise Linux 6 Reporter: Eduard Benes <ebenes>
Component: pythonAssignee: Dave Malcolm <dmalcolm>
Status: CLOSED ERRATA QA Contact: Petr Šplíchal <psplicha>
Severity: high Docs Contact:
Priority: high    
Version: 6.0CC: ddumas, nphilipp, ohudlick, psplicha, syeghiay, zmraz
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-2.6.6-26.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 734844 849988 (view as bug list) Environment:
Last Closed: 2011-12-06 10:24:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 628730, 682670, 849988    

Description Eduard Benes 2011-04-18 11:55:32 UTC
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.

Comment 1 Zbysek MRAZ 2011-04-18 12:16:30 UTC
*** Bug 697472 has been marked as a duplicate of this bug. ***

Comment 2 Dave Malcolm 2011-04-18 17:23:50 UTC
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)

Comment 3 Dave Malcolm 2011-04-18 17:26:10 UTC
Looks similar to this upstream bug:
  http://bugs.python.org/issue4591

Comment 28 errata-xmlrpc 2011-12-06 10:24:10 UTC
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