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 - os.lstat() returns negative values for owner and/or group for huge UID/GIDs on i386
Summary: os.lstat() returns negative values for owner and/or group for huge UID/GIDs o...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python
Version: 6.0
Hardware: i386
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Dave Malcolm
QA Contact: Petr Šplíchal
URL:
Whiteboard:
: 697472 (view as bug list)
Depends On:
Blocks: 628730 682670 849988
TreeView+ depends on / blocked
 
Reported: 2011-04-18 11:55 UTC by Eduard Benes
Modified: 2016-06-01 01:41 UTC (History)
6 users (show)

Fixed In Version: python-2.6.6-26.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 734844 849988 (view as bug list)
Environment:
Last Closed: 2011-12-06 10:24:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1564 0 normal SHIPPED_LIVE python bug fix and enhancement update 2011-12-06 00:39:12 UTC

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


Note You need to log in before you can comment on or make changes to this bug.