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.

classification
Title: setgroups rejects long integer arguments
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, georg.brandl, loewis, prjsf
Priority: normal Keywords:

Created on 2004-01-02 09:38 by prjsf, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
setgroups.diff georg.brandl, 2005-11-11 08:44 Patch #2
Messages (6)
msg19520 - (view) Author: Paul Jarc (prjsf) Date: 2004-01-02 09:38
os.setgroups ought to accept long integer arguments,
just as os.setgid does.  I think this worked in an
earlier version of Python - or maybe it was that
string.atol used to return a non-long integer if the
number was small enough, so I didn't encounter long
integers at all.

>>> import os
>>> os.setgid(1L)
>>> os.setgroups((1L,))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: groups must be integers
>>> import sys
>>> print sys.version
2.3.3 (#1, Dec 30 2003, 22:52:56) 
[GCC 3.2.3]
msg19521 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-29 20:36
Logged In: YES 
user_id=1188172

Attaching patch against CVS head. Please review.
msg19522 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-10-02 08:52
Logged In: YES 
user_id=21627

Would that be the time to check that the value fits into a
gid_t? 

I think the strategy would be this:
- assign the value to grouplist[i]
- read it back again
- check if this is still the same value

msg19523 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-11-11 08:44
Logged In: YES 
user_id=1188172

Adding enhanced patch.
msg19524 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-11-13 10:16
Logged In: YES 
user_id=21627

The patch looks fine, please apply. Please remove the unused
variable check, though.
msg19525 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-11-22 19:31
Logged In: YES 
user_id=1188172

Committed in revs 41514 and 41515 (2.4).
History
Date User Action Args
2022-04-11 14:56:01adminsetgithub: 39751
2004-01-02 09:38:26prjsfcreate