msg177320 - (view) |
Author: Gregory P. Smith (gregory.p.smith) *  |
Date: 2012-12-11 03:46 |
test_posix.test_getgrouplist is failing for me on my Linux (ubuntu precise) based desktop at work. It looks like posix.getgrouplist() is returning all of the larger GIDs. The lowest one it is reporting for my user is 499 but the more distro specific groups that I am are not included in its 18 element long list it returns so the test fails: test test_posix failed -- Traceback (most recent call last): File "cpython/default/Lib/test/test_posix.py", line 660, in test_getgrouplist pwd.getpwuid(os.getuid())[3]))) AssertionError: Items in the first set but not the second: 128 4 104 44 46 20 24 25 strace reveals that the 'id -G' command this test is trying to compare against calls getgroups() while posix.getgrouplist() appears to do something else that does not make that syscall. posix.getgroups() does the same thing as 'id -G', this test for posix.getgrouplist(username, uid) is making an incorrect assertion. |
|
|
msg177321 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2012-12-11 07:08 |
It seems like getgrouplist returns the information from the system database whereas getgroups (and consequently id -G) returns the supplementary groups for the calling process. I'm not exactly sure how getgrouplist() can be effectively tested then. |
|
|
msg177322 - (view) |
Author: Gregory P. Smith (gregory.p.smith) *  |
Date: 2012-12-11 07:23 |
would the values returned by getgrouplist always be a non empty subset of getgroups? (regardless, I expect the id -G process output parsing can be removed) |
|
|
msg177323 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2012-12-11 07:34 |
I wouldn't think so. A call to setgroups can add or remove groups for the calling process. If it removes groups, then getgrouplist() won't return a subset of getgroups(). |
|
|
msg177325 - (view) |
Author: Gregory P. Smith (gregory.p.smith) *  |
Date: 2012-12-11 07:38 |
Given this is more of a code coverage test than any need to test the functionality of the OS library call, just asserting that it returns a non-empty list is a decent test. :) |
|
|
msg177409 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-13 15:24 |
New changeset ce85fe971e0a by Ross Lagerwall in branch '3.3': Issue #16661: Fix the os.getgrouplist() test by not assuming that it http://hg.python.org/cpython/rev/ce85fe971e0a New changeset 05a37954a30c by Ross Lagerwall in branch 'default': Merge with 3.3 for #16661 http://hg.python.org/cpython/rev/05a37954a30c |
|
|
msg177411 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2012-12-13 16:18 |
Is that fixed now? I simplified the test to check for a non-empty list being returned. |
|
|
msg177598 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2012-12-16 13:29 |
Apparently this also needs fixing on 2.7 and 3.2, see e.g. http://buildbot.python.org/all/builders/AMD64%20Mountain%20Lion%20%5BSB%5D%203.2 |
|
|
msg177600 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2012-12-16 14:03 |
getgrouplist() is new in 3.3. Those failures are from getgroups() failing. I'll open a separate issue for that. |
|
|
msg177629 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2012-12-16 21:31 |
The getgroups test failure on OS X is likely the known limitation documented in . |
|
|