Issue 9581: PosixGroupsTester fails as root (original) (raw)

Created on 2010-08-12 20:47 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
2.6.diff quiver,2010-08-13 06:42 fix for 2.6 branch
test_setgroups.diff quiver,2010-08-13 14:21 fix for 2.7 test_setgroups
py3k.diff quiver,2010-08-13 14:26 fix for py3k branch(test_initgroups/test_setgroups)
Messages (7)
msg113705 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-12 20:47
I get the following test_posix failures when run as root (Mandriva Linux): ====================================================================== ERROR: test_initgroups (test.test_posix.PosixGroupsTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/py3k/__svn__/Lib/test/test_posix.py", line 418, in test_initgroups g = g2 + 1 UnboundLocalError: local variable 'g2' referenced before assignment ====================================================================== FAIL: test_setgroups (test.test_posix.PosixGroupsTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/py3k/__svn__/Lib/test/test_posix.py", line 428, in test_setgroups self.assertListEqual(groups, posix.getgroups()) AssertionError: First sequence is not a list: range(0, 16) Under 2.6, there's another failure: ====================================================================== ERROR: test_setgroups (test.test_posix.PosixGroupsTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/26/Lib/test/test_posix.py", line 356, in test_setgroups self.assertListEqual(groups, posix.getgroups()) AttributeError: 'PosixGroupsTester' object has no attribute 'assertListEqual'
msg113744 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-08-13 05:55
I won't have time to look at this until sunday. Alexander Belopolsky wrote these patch tests. Alexanders: do you have time to look into this?
msg113745 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2010-08-13 06:42
> Under 2.6, there's another failure: As for 2.6/2.7 issues, changing 'assertListEqual' to 'assertEqual' should suffice.
msg113774 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2010-08-13 13:50
test_initgroups fails only if the test is invoked by a root and the user is assigned to only one group. If I understand test_initgroups correctly, it (1)looks for an unused gid, (2)inits process user's group with that gid, (3)checks if initgroups worked. Attached patch simplifies step #1 "max(self.saved_groups) + 1" is used. test_initgroups passed when root's groups are as follows:: * [0] * [0, 3, 5] * [0, 1, 2]
msg113778 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2010-08-13 14:25
> FAIL: test_setgroups (test.test_posix.PosixGroupsTester) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "/home/antoine/py3k/__svn__/Lib/test/test_posix.py", line 428, in test_setgroups > self.assertListEqual(groups, posix.getgroups()) > AssertionError: First sequence is not a list: range(0, 16) This one is just a list/range data type issue. patch for test_initgroups/test_setgroups against py3k attached
msg113782 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-13 15:05
George's patches work for me (thank you!).
msg115591 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-04 17:34
I've committed modified patches for 3.x, 3.1 and 2.7. Thanks again George.
History
Date User Action Args
2022-04-11 14:57:05 admin set github: 53790
2010-09-04 17:34:42 pitrou set status: open -> closedassignee: ronaldoussoren -> nobodyversions: - Python 2.6nosy: + nobodymessages: + resolution: fixedstage: needs patch -> resolved
2010-08-13 15:05:01 pitrou set messages: +
2010-08-13 14:26:39 quiver set files: + py3k.diff
2010-08-13 14:25:40 quiver set messages: +
2010-08-13 14:21:17 quiver set files: + test_setgroups.diff
2010-08-13 14:20:47 quiver set files: - test_setgroups.diff
2010-08-13 13:50:13 quiver set files: + test_setgroups.diffmessages: +
2010-08-13 06:42:21 quiver set files: + 2.6.diffnosy: + quivermessages: + keywords: + patch
2010-08-13 05:55:13 ronaldoussoren set nosy: + belopolskymessages: +
2010-08-12 20:47:20 pitrou create