Issue 9344: please add posix.getgrouplist() (original) (raw)

Created on 2010-07-23 13:10 by ronaldoussoren, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
9344.patch rosslagerwall,2010-12-12 10:41 patch to implement getgrouplist for py3k against r87178 review
9344_v2.patch rosslagerwall,2011-01-04 05:19 Updated patch review
Messages (16)
msg111309 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) 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) * (Python committer) 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) (Python committer) 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) (Python committer) Date: 2011-01-04 05:19
A slightly updated patch. Targeting for 3.3.
msg125304 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) (Python committer) 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) * (Python committer) 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) (Python triager) 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) (Python committer) Date: 2011-06-10 05:59
Thanks!
msg138103 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 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) (Python committer) 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) * (Python committer) 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.
History
Date User Action Args
2022-04-11 14:57:04 admin set github: 53590
2011-06-16 22:59:08 r.david.murray set nosy: + r.david.murraymessages: +
2011-06-10 16:24:12 rosslagerwall set messages: +
2011-06-10 16:21:32 pitrou set resolution: accepted -> fixedmessages: +
2011-06-10 05:59:50 rosslagerwall set status: open -> closedresolution: acceptedmessages: + stage: commit review -> resolved
2011-06-10 05:33:18 python-dev set nosy: + python-devmessages: +
2011-06-09 20:55:34 ronaldoussoren set messages: +
2011-03-24 19:23:23 rosslagerwall set messages: +
2011-03-24 19:20:35 belopolsky set assignee: belopolsky -> rosslagerwallmessages: +
2011-03-14 23:11:13 ronaldoussoren set nosy:ronaldoussoren, belopolsky, pitrou, giampaolo.rodola, nvetoshkin, rosslagerwallmessages: +
2011-01-17 13:36:32 giampaolo.rodola set nosy: + giampaolo.rodola
2011-01-04 11:09:19 pitrou set nosy: + pitroumessages: + stage: needs patch -> commit review
2011-01-04 05:19:35 rosslagerwall set files: + 9344_v2.patchversions: + Python 3.3, - Python 3.2messages: + nosy:ronaldoussoren, belopolsky, nvetoshkin, rosslagerwall
2010-12-12 10:41:02 rosslagerwall set files: + 9344.patchnosy: + rosslagerwallmessages: + keywords: + patch
2010-10-18 18:57:41 nvetoshkin set messages: +
2010-10-18 18:50:44 belopolsky set messages: +
2010-10-15 16:08:38 nvetoshkin set nosy: + nvetoshkinmessages: +
2010-07-23 15:45:08 belopolsky set assignee: belopolskytype: enhancementcomponents: + Extension Modulesstage: needs patch
2010-07-23 13:11:21 ronaldoussoren set nosy: + belopolsky
2010-07-23 13:10:56 ronaldoussoren create