8000 gh-94518: Rename `group*` to `extra_group*` to avoid confusion by arhadthedev · Pull Request #101054 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-94518: Rename group* to extra_group* to avoid confusion #101054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rename group* to extra_group* to avoid confusion
  • Loading branch information
arhadthedev committed Jan 15, 2023
commit 73ce627144cdcb857638ee69035ede2d12d585ba
30 changes: 15 additions & 15 deletions Modules/_posixsubprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ child_exec(char *const exec_array[],
int close_fds, int restore_signals,
int call_setsid, pid_t pgid_to_set,
gid_t gid,
Py_ssize_t groups_size, const gid_t *groups,
Py_ssize_t extra_group_size, const gid_t *extra_groups,
uid_t uid, int child_umask,
const void *child_sigmask,
PyObject *py_fds_to_keep,
Expand Down Expand Up @@ -619,8 +619,8 @@ child_exec(char *const exec_array[],
#endif

#ifdef HAVE_SETGROUPS
if (groups_size > 0)
POSIX_CALL(setgroups(groups_size, groups));
if (extra_group_size > 0)
POSIX_CALL(setgroups(extra_group_size, extra_groups));
#endif /* HAVE_SETGROUPS */

#ifdef HAVE_SETREGID
Expand Down Expand Up @@ -725,7 +725,7 @@ do_fork_exec(char *const exec_array[],
int close_fds, int restore_signals,
int call_setsid, pid_t pgid_to_set,
gid_t gid,
Py_ssize_t groups_size, const gid_t *groups,
Py_ssize_t extra_group_size, const gid_t *extra_groups,
uid_t uid, int child_umask,
const void *child_sigmask,
PyObject *py_fds_to_keep,
Expand All @@ -740,7 +740,7 @@ do_fork_exec(char *const exec_array[],
/* These are checked by our caller; verify them in debug builds. */
assert(uid == (uid_t)-1);
assert(gid == (gid_t)-1);
assert(groups_size < 0);
assert(extra_group_size < 0);
assert(preexec_fn == Py_None);

pid = vfork();
Expand Down Expand Up @@ -777,7 +777,7 @@ do_fork_exec(char *const exec_array[],
p2cread, p2cwrite, c2pread, c2pwrite,
errread, errwrite, errpipe_read, errpipe_write,
close_fds, restore_signals, call_setsid, pgid_to_set,
gid, groups_size, groups,
gid, extra_group_size, extra_groups,
uid, child_umask, child_sigmask,
py_fds_to_keep, preexec_fn, preexec_fn_args_tuple);
_exit(255);
Expand All @@ -799,7 +799,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
int errpipe_read, errpipe_write, close_fds, restore_signals;
int call_setsid;
pid_t pgid_to_set = -1;
gid_t *groups = NULL;
gid_t *extra_groups = NULL;
int child_umask;
PyObject *cwd_obj, *cwd_obj2 = NULL;
const char *cwd;
Expand Down Expand Up @@ -908,14 +908,14 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
goto cleanup;

if (num_groups > MAX_GROUPS) {
PyErr_SetString(PyExc_ValueError, "too many groups");
PyErr_SetString(PyExc_ValueError, "too many extra_groups");
goto cleanup;
}

/* Deliberately keep groups == NULL for num_groups == 0 */
/* Deliberately keep extra_groups == NULL for num_groups == 0 */
if (num_groups > 0) {
groups = PyMem_RawMalloc(num_groups * sizeof(gid_t));
8000 if (groups == NULL) {
extra_groups = PyMem_RawMalloc(num_groups * sizeof(gid_t));
if (extra_groups == NULL) {
PyErr_SetString(PyExc_MemoryError,
"failed to allocate memory for group list");
goto cleanup;
Expand All @@ -929,7 +929,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
goto cleanup;
if (!PyLong_Check(elem)) {
PyErr_SetString(PyExc_TypeError,
"groups must be integers");
"extra_groups must be integers");
Py_DECREF(elem);
goto cleanup;
} else {
Expand All @@ -939,7 +939,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
PyErr_SetString(PyExc_ValueError, "invalid group id");
goto cleanup;
}
groups[i] = gid;
extra_groups[i] = gid;
}
Py_DECREF(elem);
}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
p2cread, p2cwrite, c2pread, c2pwrite,
errread, errwrite, errpipe_read, errpipe_write,
close_fds, restore_signals, call_setsid, pgid_to_set,
gid, num_groups, groups,
gid, num_groups, extra_groups,
uid, child_umask, old_sigmask,
py_fds_to_keep, preexec_fn, preexec_fn_args_tuple);

Expand Down Expand Up @@ -1054,7 +1054,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
}

Py_XDECREF(preexec_fn_args_tuple);
PyMem_RawFree(groups);
PyMem_RawFree(extra_groups);
Py_XDECREF(cwd_obj2);
if (envp)
_Py_FreeCharPArray(envp);
Expand Down
0