Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please add posix.getgrouplist() #53590

Closed
ronaldoussoren opened this issue Jul 23, 2010 · 16 comments
Closed

please add posix.getgrouplist() #53590

ronaldoussoren opened this issue Jul 23, 2010 · 16 comments
Labels
easy extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@ronaldoussoren
Copy link
Contributor

BPO 9344
Nosy @ronaldoussoren, @abalkin, @pitrou, @giampaolo, @bitdancer
Files
  • 9344.patch: patch to implement getgrouplist for py3k against r87178
  • 9344_v2.patch: Updated patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2011-06-10.05:59:50.270>
    created_at = <Date 2010-07-23.13:10:56.630>
    labels = ['extension-modules', 'easy', 'type-feature']
    title = 'please add posix.getgrouplist()'
    updated_at = <Date 2011-06-16.22:59:08.871>
    user = 'https://github.com/ronaldoussoren'

    bugs.python.org fields:

    activity = <Date 2011-06-16.22:59:08.871>
    actor = 'r.david.murray'
    assignee = 'rosslagerwall'
    closed = True
    closed_date = <Date 2011-06-10.05:59:50.270>
    closer = 'rosslagerwall'
    components = ['Extension Modules']
    creation = <Date 2010-07-23.13:10:56.630>
    creator = 'ronaldoussoren'
    dependencies = []
    files = ['20024', '20253']
    hgrepos = []
    issue_num = 9344
    keywords = ['patch', 'easy']
    message_count = 16.0
    messages = ['111309', '118791', '119062', '119065', '123834', '125293', '125304', '130927', '132021', '132022', '138028', '138049', '138051', '138103', '138105', '138476']
    nosy_count = 8.0
    nosy_names = ['ronaldoussoren', 'belopolsky', 'pitrou', 'giampaolo.rodola', 'r.david.murray', 'nvetoshkin', 'rosslagerwall', 'python-dev']
    pr_nums = []
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue9344'
    versions = ['Python 3.3']

    @ronaldoussoren
    Copy link
    Contributor Author

    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 bpo-7900 for more information on why that would be useful.

    @abalkin abalkin added the extension-modules C modules in the Modules dir label Jul 23, 2010
    @abalkin abalkin self-assigned this Jul 23, 2010
    @abalkin abalkin added the type-feature A feature request or enhancement label Jul 23, 2010
    @nvetoshkin
    Copy link
    Mannequin

    nvetoshkin mannequin commented Oct 15, 2010

    @abalkin
    Copy link
    Member

    abalkin commented Oct 18, 2010

    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.

    @nvetoshkin
    Copy link
    Mannequin

    nvetoshkin mannequin commented Oct 18, 2010

    @alexander, it was just a note, that implementation in posixmodule.c won't be the same across all flavours of Unix :)

    @rosslagerwall
    Copy link
    Mannequin

    rosslagerwall mannequin commented Dec 12, 2010

    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.

    @rosslagerwall
    Copy link
    Mannequin

    rosslagerwall mannequin commented Jan 4, 2011

    A slightly updated patch. Targeting for 3.3.

    @pitrou
    Copy link
    Member

    pitrou commented Jan 4, 2011

    I can't say anything about the functionality, but the patch looks good to me (works under Linux and Solaris - the latter missing getgrouplist()).

    @ronaldoussoren
    Copy link
    Contributor Author

    Patch looks good, but this likely runs into the same problem as bpo-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).

    @abalkin
    Copy link
    Member

    abalkin commented Mar 24, 2011

    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.

    @abalkin abalkin assigned rosslagerwall and unassigned abalkin Mar 24, 2011
    @rosslagerwall
    Copy link
    Mannequin

    rosslagerwall mannequin commented Mar 24, 2011

    Ronald, does it have the same problem as bpo-7900 on OS X or can I commit?

    @ronaldoussoren
    Copy link
    Contributor Author

    I haven't tested yet, but feel free to commit and I'll fix any OSX issues later.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 10, 2011

    New changeset 9ebee3211be9 by Ross Lagerwall in branch 'default':
    Issue bpo-9344: Add os.getgrouplist().
    http://hg.python.org/cpython/rev/9ebee3211be9

    @rosslagerwall
    Copy link
    Mannequin

    rosslagerwall mannequin commented Jun 10, 2011

    Thanks!

    @rosslagerwall rosslagerwall mannequin closed this as completed Jun 10, 2011
    @pitrou
    Copy link
    Member

    pitrou commented Jun 10, 2011

    Nit: when a patch gets committed and the issue closed, the preferred resolution is "fixed" ;)
    (see http://docs.python.org/devguide/triaging.html#resolution)

    @rosslagerwall
    Copy link
    Mannequin

    rosslagerwall mannequin commented Jun 10, 2011

    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.

    @bitdancer
    Copy link
    Member

    Actually, when it is a feature request rather than a bug fix we usually use 'accepted'. It doesn't matter a whole lot, though.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants