Skip to content
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_grp and test_pwd fail with 32-bit builds on OS X systems #61733

Closed
ned-deily opened this issue Mar 23, 2013 · 11 comments
Closed

test_grp and test_pwd fail with 32-bit builds on OS X systems #61733

ned-deily opened this issue Mar 23, 2013 · 11 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@ned-deily
Copy link
Member

BPO 17531
Nosy @benjaminp, @ned-deily, @serhiy-storchaka

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:

assignee = None
closed_at = <Date 2013-03-23.21:34:27.600>
created_at = <Date 2013-03-23.20:00:15.566>
labels = ['type-bug', 'tests']
title = 'test_grp and test_pwd fail with 32-bit builds on OS X systems'
updated_at = <Date 2013-03-23.21:36:22.995>
user = 'https://github.com/ned-deily'

bugs.python.org fields:

activity = <Date 2013-03-23.21:36:22.995>
actor = 'python-dev'
assignee = 'none'
closed = True
closed_date = <Date 2013-03-23.21:34:27.600>
closer = 'ned.deily'
components = ['Tests']
creation = <Date 2013-03-23.20:00:15.566>
creator = 'ned.deily'
dependencies = []
files = []
hgrepos = []
issue_num = 17531
keywords = []
message_count = 11.0
messages = ['185081', '185082', '185084', '185085', '185086', '185087', '185088', '185090', '185093', '185095', '185097']
nosy_count = 4.0
nosy_names = ['benjamin.peterson', 'ned.deily', 'python-dev', 'serhiy.storchaka']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue17531'
versions = ['Python 2.7']

@ned-deily
Copy link
Member Author

With the changes introduced for bpo-4591, test_grp and test_pwd now fail on OS X systems when Python is run in 32-bit mode.

Previously, using a 64-bit/32-bit universal build of 2.7.3:

$ arch -i386 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nobody").gr_gid; print(g,type(g))'
(-2, <type 'int'>)
$ arch -x86_64 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nobody").gr_gid; print(g,type(g))'
(4294967294, <type 'int'>)

Now, with 2.7.4rc1:

$ arch -i386 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nobody").gr_gid; print(g,type(g))'
(4294967294L, <type 'long'>)
$ arch -x86_64 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nobody").gr_gid; print(g,type(g))'
(4294967294, <type 'int'>)

This results in test failures in both test_grp and test_pwd:

======================================================================
FAIL: test_values (test.test_grp.GroupDatabaseTestCase)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_grp.py", line 27, in test_values
    self.check_value(e)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_grp.py", line 19, in check_value
    self.assertIsInstance(value.gr_gid, int)
AssertionError: 4294967294L is not an instance of <type 'int'>

----------------------------------------------------------------------

======================================================================
FAIL: test_values (test.test_pwd.PwdTest)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_pwd.py", line 23, in test_values
    self.assertIsInstance(e.pw_gid, int)
AssertionError: 4294967294L is not an instance of <type 'int'>

@ned-deily ned-deily added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Mar 23, 2013
@ned-deily
Copy link
Member Author

Failure also seen on 32-bit buildbot:
http://buildbot.python.org/all/builders/x86%20Tiger%202.7

@python-dev
Copy link
Mannequin

python-dev mannequin commented Mar 23, 2013

New changeset 2aa817e0a645 by Benjamin Peterson in branch '2.7':
return int instead long when possible (bpo-17531)
http://hg.python.org/cpython/rev/2aa817e0a645

@benjaminp
Copy link
Contributor

I hope that does it?

@benjaminp
Copy link
Contributor

No, that was wrong, sorry.

@benjaminp
Copy link
Contributor

I think the tests are wrong.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Mar 23, 2013

New changeset c982393bea4e by Benjamin Peterson in branch '2.7':
group ids and user ids can be longs now (bpo-17531)
http://hg.python.org/cpython/rev/c982393bea4e

@ned-deily
Copy link
Member Author

That fixes the test for nobody (-2). Now the next part of the test fails more seriously for nogroup (-1). Simplifying:

2.7.3
$ arch -i386 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nogroup").gr_gid; print(grp.getgrgid(g),type(g))'
(grp.struct_group(gr_name='nogroup', gr_passwd='*', gr_gid=-1, gr_mem=[]), <type 'int'>)
$ arch -x86_64 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nogroup").gr_gid; print(grp.getgrgid(g),type(g))'
(grp.struct_group(gr_name='nogroup', gr_passwd='*', gr_gid=4294967295, gr_mem=[]), <type 'int'>)

2.7.4rc1:
$ arch -i386 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nogroup").gr_gid; print(grp.getgrgid(g),type(g))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OverflowError: group id is greater than maximum
$ arch -x86_64 /usr/local/bin/python2.7 -c 'import grp; g=grp.getgrnam("nogroup").gr_gid; print(grp.getgrgid(g),type(g))'
(grp.struct_group(gr_name='nogroup', gr_passwd='*', gr_gid=4294967295, gr_mem=[]), <type 'int'>)

@benjaminp
Copy link
Contributor

Whack, whack. a4dbe53577cb

@ned-deily
Copy link
Member Author

a4dbe53577cb appears to fix the latter problem. Thanks!

@python-dev
Copy link
Mannequin

python-dev mannequin commented Mar 23, 2013

New changeset 87d266988905 by Benjamin Peterson in branch '2.7':
update NEWS for bpo-17531
http://hg.python.org/cpython/rev/87d266988905

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants