msg111309 - (view) |
Author: Ronald Oussoren (ronaldoussoren) *  |
Date: 2010-07-23 13:10 |
A number of unix systems expose a getgroupslist function to fetch the groups that a user is a member of. It would be nice if that function were exposed to python. See for more information on why that would be useful. |
|
|
msg118791 - (view) |
Author: Vetoshkin Nikita (nvetoshkin) |
Date: 2010-10-15 16:08 |
Did a bit of digging and found that getgrouplist signature differs on (at least) Linux and Mac OS: - http://www.kernel.org/doc/man-pages/online/pages/man3/getgrouplist.3.html -http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/getgrouplist.3.html |
|
|
msg119062 - (view) |
Author: Alexander Belopolsky (belopolsky) *  |
Date: 2010-10-18 18:50 |
I don't see how this difference is relevant for exposing the functionality in python: Linux: int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups); MacOS: int getgrouplist(const char *name, int basegid, int *groups, int *ngroups); The only difference is that Linux uses gid_t and MacOS uses int. The requested posix.getgrouplist() will take a python string and a python integer and return a list of integers. |
|
|
msg119065 - (view) |
Author: Vetoshkin Nikita (nvetoshkin) |
Date: 2010-10-18 18:57 |
@Alexander, it was just a note, that implementation in posixmodule.c won't be the same across all flavours of Unix :) |
|
|
msg123834 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2010-12-12 10:41 |
Attached is a patch (against the latest revision, 87178) which adds the functionality to the posix module as well as adds a testcase for it. I haven't added it to the os module, I'm not sure if that should be done. I tested it on Linux & FreeBSD and it works as expected. Since I don't have an OS X system, I could not test it on there. |
|
|
msg125293 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2011-01-04 05:19 |
A slightly updated patch. Targeting for 3.3. |
|
|
msg125304 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2011-01-04 11:09 |
I can't say anything about the functionality, but the patch looks good to me (works under Linux and Solaris - the latter missing getgrouplist()). |
|
|
msg130927 - (view) |
Author: Ronald Oussoren (ronaldoussoren) *  |
Date: 2011-03-14 23:11 |
Patch looks good, but this likely runs into the same problem as #7900: the user can be a member of more than NGROUPS_MAX on OSX. I'll test this tomorrow (by creating a temporary user that is a member of more than 16 groups). |
|
|
msg132021 - (view) |
Author: Alexander Belopolsky (belopolsky) *  |
Date: 2011-03-24 19:20 |
Looks good to me as well. Just a nit-pick: in python code base "sizeof" is not separated from the opening parenthesis. I understand the desire to distinguish "sizeof" from a function, but it is probably better to be consistent. |
|
|
msg132022 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2011-03-24 19:23 |
Ronald, does it have the same problem as #7900 on OS X or can I commit? |
|
|
msg138028 - (view) |
Author: Ronald Oussoren (ronaldoussoren) *  |
Date: 2011-06-09 20:55 |
I haven't tested yet, but feel free to commit and I'll fix any OSX issues later. |
|
|
msg138049 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2011-06-10 05:33 |
New changeset 9ebee3211be9 by Ross Lagerwall in branch 'default': Issue #9344: Add os.getgrouplist(). http://hg.python.org/cpython/rev/9ebee3211be9 |
|
|
msg138051 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2011-06-10 05:59 |
Thanks! |
|
|
msg138103 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2011-06-10 16:21 |
Nit: when a patch gets committed and the issue closed, the preferred resolution is "fixed" ;) (see http://docs.python.org/devguide/triaging.html#resolution) |
|
|
msg138105 - (view) |
Author: Ross Lagerwall (rosslagerwall)  |
Date: 2011-06-10 16:24 |
> Nit: when a patch gets committed and the issue closed, the preferred > resolution is "fixed" ;) > (see http://docs.python.org/devguide/triaging.html#resolution) Sure, I will try remember that. |
|
|
msg138476 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2011-06-16 22:59 |
Actually, when it is a feature request rather than a bug fix we usually use 'accepted'. It doesn't matter a whole lot, though. |
|
|