bpo-35070: test_getgrouplist may fail on macOS if too many groups by websurfer5 · Pull Request #13071 · python/cpython

@websurfer5

The test_getgroups subtest fails when the current user running the
test belongs to the maximum number supplemental groups. It
fails because posix.getgrouplist() passes an array to the POSIX API
function getgrouplist() that is too small. It uses NGROUPS_MAX to
determine the size of the array that it passes to getgrouplist()
to be filled with the user's GIDs. NGROUPS_MAX is defined by POSIX.1
as the maximum number of supplimental groups a user can belong to.
The value has to be increased by one because getgrouplist() returns
both the supplemental groups and the primary group, i.e. all of the
groups the user belongs to.

NGROUPS_MAX is defined as 16 on OS X systems, so the test fails when
the user belongs to 16 supplemental groups because it passes an array
with 16 elements to receive the GIDs, but getgrouplist() returns an
error because it wants to return 17 GIDs (the primary plus 16
supplemntals).

This problem most likely is not seen on Linux systems because they typically
have a much higher limit for supplemental groups (e.g. 65,536 on
Ubuntu 16.04.4).

@websurfer5 websurfer5 changed the title BPO-35070: test_posix fails on macOS 10.14 Mojave bpo-35070: test_posix fails on macOS 10.14 Mojave

May 3, 2019

dpage

@blurb-it

ned-deily

@ned-deily ned-deily changed the title bpo-35070: test_posix fails on macOS 10.14 Mojave bpo-35070: test_getgrouplist may fail on macOS if too many groups

Jun 3, 2019

@websurfer5

…istent

throughout the source file; update news blurb with requested changes

ned-deily

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jun 13, 2019
…thonGH-13071)

(cherry picked from commit 8725c83)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jun 13, 2019
…thonGH-13071)

(cherry picked from commit 8725c83)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>

miss-islington added a commit that referenced this pull request

Jun 13, 2019
…-13071)

(cherry picked from commit 8725c83)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>

miss-islington added a commit that referenced this pull request

Jun 13, 2019
…-13071)

(cherry picked from commit 8725c83)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>

lisroach pushed a commit to lisroach/cpython that referenced this pull request

Sep 10, 2019

DinoV pushed a commit to DinoV/cpython that referenced this pull request

Jan 14, 2020