Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8725c83e
Commit
8725c83e
authored
Jun 13, 2019
by
Jeffrey Kintscher
Committed by
Ned Deily
Jun 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35070: test_getgrouplist may fail on macOS if too many groups (GH-13071)
parent
905e19a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
Misc/NEWS.d/next/Library/2019-05-09-18-50-55.bpo-35070.4vaqNL.rst
...S.d/next/Library/2019-05-09-18-50-55.bpo-35070.4vaqNL.rst
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+17
-15
No files found.
Misc/NEWS.d/next/Library/2019-05-09-18-50-55.bpo-35070.4vaqNL.rst
0 → 100644
View file @
8725c83e
posix.getgrouplist() now works correctly when the user belongs to
NGROUPS_MAX supplemental groups. Patch by Jeffrey Kintscher.
Modules/posixmodule.c
View file @
8725c83e
...
...
@@ -6722,6 +6722,13 @@ os_getpid_impl(PyObject *module)
}
#endif
/* HAVE_GETPID */
#ifdef NGROUPS_MAX
#define MAX_GROUPS NGROUPS_MAX
#else
/* defined to be 16 on Solaris7, so this should be a small number */
#define MAX_GROUPS 64
#endif
#ifdef HAVE_GETGROUPLIST
/* AC 3.5: funny apple logic below */
...
...
@@ -6734,13 +6741,6 @@ Returns a list of groups to which a user belongs.\n\n\
static
PyObject
*
posix_getgrouplist
(
PyObject
*
self
,
PyObject
*
args
)
{
#ifdef NGROUPS_MAX
#define MAX_GROUPS NGROUPS_MAX
#else
/* defined to be 16 on Solaris7, so this should be a small number */
#define MAX_GROUPS 64
#endif
const
char
*
user
;
int
i
,
ngroups
;
PyObject
*
list
;
...
...
@@ -6749,7 +6749,16 @@ posix_getgrouplist(PyObject *self, PyObject *args)
#else
gid_t
*
groups
,
basegid
;
#endif
ngroups
=
MAX_GROUPS
;
/*
* NGROUPS_MAX is defined by POSIX.1 as the maximum
* number of supplimental groups a users can belong to.
* We have to increment it by one because
* getgrouplist() returns both the supplemental groups
* and the primary group, i.e. all of the groups the
* user belongs to.
*/
ngroups
=
1
+
MAX_GROUPS
;
#ifdef __APPLE__
if
(
!
PyArg_ParseTuple
(
args
,
"si:getgrouplist"
,
&
user
,
&
basegid
))
...
...
@@ -6818,13 +6827,6 @@ os_getgroups_impl(PyObject *module)
/*[clinic end generated code: output=42b0c17758561b56 input=d3f109412e6a155c]*/
{
PyObject
*
result
=
NULL
;
#ifdef NGROUPS_MAX
#define MAX_GROUPS NGROUPS_MAX
#else
/* defined to be 16 on Solaris7, so this should be a small number */
#define MAX_GROUPS 64
#endif
gid_t
grouplist
[
MAX_GROUPS
];
/* On MacOSX getgroups(2) can return more than MAX_GROUPS results
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment