[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

STINNER Victor report at bugs.python.org
Mon Mar 23 18:17:06 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

> Moreover, on Linux, getgrouplist() can also fail with -1 if the group list is too small. In that case, ngroups is updated to the number of groups and so can be used to enlarge the list!

I tested by manually initializing ngroups to a value way lower than MAX_GROUPS (65536 on my Fedora 31): os.getgrouplist() raises OSError() with a random errno, getgrouplist() doesn't set errno on failure.

I wrote PR 19126 to fix the issue on all platforms. The glibc implementation is detected and used: use updated ngroups value (only if it's larger).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40014>
_______________________________________


More information about the Python-bugs-list mailing list