Issue 17531: test_grp and test_pwd fail with 32-bit builds on OS X systems (original) (raw)

Created on 2013-03-23 20:00 by ned.deily, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (11)

msg185081 - (view)

Author: Ned Deily (ned.deily) * (Python committer)

Date: 2013-03-23 20:00

With the changes introduced for Issue4591, 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'>


msg185082 - (view)

Author: Ned Deily (ned.deily) * (Python committer)

Date: 2013-03-23 20:12

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

msg185084 - (view)

Author: Roundup Robot (python-dev) (Python triager)

Date: 2013-03-23 20:24

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

msg185085 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2013-03-23 20:25

I hope that does it?

msg185086 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2013-03-23 20:32

No, that was wrong, sorry.

msg185087 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2013-03-23 20:41

I think the tests are wrong.

msg185088 - (view)

Author: Roundup Robot (python-dev) (Python triager)

Date: 2013-03-23 20:41

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

msg185090 - (view)

Author: Ned Deily (ned.deily) * (Python committer)

Date: 2013-03-23 21:01

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 "", line 1, in 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'>)

msg185093 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2013-03-23 21:32

Whack, whack. a4dbe53577cb

msg185095 - (view)

Author: Ned Deily (ned.deily) * (Python committer)

Date: 2013-03-23 21:34

a4dbe53577cb appears to fix the latter problem. Thanks!

msg185097 - (view)

Author: Roundup Robot (python-dev) (Python triager)

Date: 2013-03-23 21:36

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

History

Date

User

Action

Args

2022-04-11 14:57:43

admin

set

github: 61733

2013-03-23 21:36:22

python-dev

set

messages: +

2013-03-23 21:34:27

ned.deily

set

status: open -> closed
resolution: fixed
messages: +

stage: resolved

2013-03-23 21:32:34

benjamin.peterson

set

messages: +

2013-03-23 21:01:39

ned.deily

set

messages: +

2013-03-23 20:41:23

python-dev

set

messages: +

2013-03-23 20:41:20

benjamin.peterson

set

messages: +

2013-03-23 20:32:07

benjamin.peterson

set

messages: +

2013-03-23 20:25:11

benjamin.peterson

set

messages: +

2013-03-23 20:24:42

python-dev

set

nosy: + python-dev
messages: +

2013-03-23 20:12:13

ned.deily

set

messages: +

2013-03-23 20:00:15

ned.deily

create