This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: documentation for os.getgrouplist potentially misleading
Type: enhancement Stage: patch review
Components: Documentation Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, woodfighter
Priority: normal Keywords: patch

Created on 2020-04-24 11:03 by woodfighter, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 19702 open woodfighter, 2020-04-24 12:00
Messages (1)
msg367187 - (view) Author: Jens Holzkämper (woodfighter) * Date: 2020-04-24 11:03
https://docs.python.org/3/library/os.html#os.getgrouplist states „Return list of group ids that user belongs to. If group is not in the list, it is included; typically, group is specified as the group ID field from the password record for user.“, but the function is at least on Linux a wrapper for getgrouplist from the C standard library, which lists only the membership in groups in the group-database. Users can be members of groups without it being declared in the group database, this is often the case with the default group of the user which is only declared in the passwd database.

e.g. 
/etc/passwd: woodfighter:x:1000:1000:,,,:/home/woodfighter:/bin/bash
/etc/group: woodfighter:x:1000:

os.getgrouplist("woodfighter",65534) then doesn't contain group id 1000.

The documentation tries to steer a developer in the right direction with the second sentence but fails to state, that the list will be possibly incomplete otherwise. I would add something like „, because that group ID will otherwise be potentially omitted.“ before the last period.
History
Date User Action Args
2022-04-11 14:59:29adminsetgithub: 84556
2020-04-24 12:00:32woodfightersetkeywords: + patch
stage: patch review
pull_requests: + pull_request19020
2020-04-24 11:03:54woodfightercreate