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.

Title: test_grp
Type: behavior Stage: patch review
Components: Tests Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Matthias Braun, mjbrands
Priority: normal Keywords: patch

Created on 2019-02-17 21:15 by mjbrands, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 19033 open Matthias Braun, 2020-03-16 21:43
Messages (1)
msg335788 - (view) Author: Mathijs Brands (mjbrands) Date: 2019-02-17 21:26
# Choose a non-existent gid.
        fakegid = 4127
        while fakegid in bygids:
            fakegid = (fakegid * 3) % 0x10000

        self.assertRaises(KeyError, grp.getgrgid, fakegid)

When a Linux system is configured to use LDAP for user and group information, there is no guarantee that grp.getgrall will actually return a complete list of all configured groups.

In my case, grp.getgrall only returns 58 groups, while there are actually tens of thousands of groups (every user has their own group, which generally only has one member). The groups return by grp.getgrall are the 'system' groups (things like daemon, wheel, etc). In our case 4127 is an existing group and grp.getgrid can query information for it (and does not thrown the expected KeyError, since it is a valid group).

Perhaps this unit test should not rely on getgrall, but relying on getgrid on the test for getgrid itself is also problematic.

I have seen this LDAP setup, where getgrall does not return the full set of groups, at two different parties with lots of users (and Novell eDirectory).
Date User Action Args
2022-04-11 14:59:11adminsetgithub: 80198
2020-03-16 21:43:29Matthias Braunsetkeywords: + patch
nosy: + Matthias Braun

pull_requests: + pull_request18382
stage: patch review
2019-02-17 21:26:41mjbrandssetmessages: + msg335788
2019-02-17 21:15:28mjbrandscreate