[Python-checkins] r78547 - in python/branches/release26-maint: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c
gregory.p.smith
python-checkins at python.org
Mon Mar 1 06:48:57 CET 2010
Author: gregory.p.smith
Date: Mon Mar 1 06:48:57 2010
New Revision: 78547
Log:
Merged revisions 78546 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78546 | gregory.p.smith | 2010-02-28 21:43:43 -0800 (Sun, 28 Feb 2010) | 3 lines
Fixes issue #7999: os.setreuid() and os.setregid() would refuse to accept
a -1 parameter on some platforms such as OS X.
........
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Lib/test/test_os.py
python/branches/release26-maint/Misc/NEWS
python/branches/release26-maint/Modules/posixmodule.c
Modified: python/branches/release26-maint/Lib/test/test_os.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_os.py (original)
+++ python/branches/release26-maint/Lib/test/test_os.py Mon Mar 1 06:48:57 2010
@@ -643,6 +643,7 @@
self.assertRaises(os.error, os.setreuid, 0, 0)
self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
+ os.setreuid(-1, -1) # Does nothing, but it needs to accept -1
if hasattr(os, 'setregid'):
def test_setregid(self):
@@ -650,6 +651,7 @@
self.assertRaises(os.error, os.setregid, 0, 0)
self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
+ os.setregid(-1, -1) # Does nothing, but it needs to accept -1
else:
class PosixUidGidTests(unittest.TestCase):
pass
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS (original)
+++ python/branches/release26-maint/Misc/NEWS Mon Mar 1 06:48:57 2010
@@ -254,6 +254,9 @@
thread could raise an incorrect RuntimeError about not holding the import
lock. The import lock is now reinitialized after fork.
+- Issue #7999: os.setreuid() and os.setregid() would refuse to accept a -1
+ parameter on some platforms such as OS X.
+
Build
-----
Modified: python/branches/release26-maint/Modules/posixmodule.c
==============================================================================
--- python/branches/release26-maint/Modules/posixmodule.c (original)
+++ python/branches/release26-maint/Modules/posixmodule.c Mon Mar 1 06:48:57 2010
@@ -5649,9 +5649,16 @@
uid_t ruid, euid;
if (!PyArg_ParseTuple(args, "ll", &ruid_arg, &euid_arg))
return NULL;
- ruid = ruid_arg;
- euid = euid_arg;
- if (euid != euid_arg || ruid != ruid_arg) {
+ if (ruid_arg == -1)
+ ruid = (uid_t)-1; /* let the compiler choose how -1 fits */
+ else
+ ruid = ruid_arg; /* otherwise, assign from our long */
+ if (euid_arg == -1)
+ euid = (uid_t)-1;
+ else
+ euid = euid_arg;
+ if ((euid_arg != -1 && euid != euid_arg) ||
+ (ruid_arg != -1 && ruid != ruid_arg)) {
PyErr_SetString(PyExc_OverflowError, "user id too big");
return NULL;
}
@@ -5676,9 +5683,16 @@
gid_t rgid, egid;
if (!PyArg_ParseTuple(args, "ll", &rgid_arg, &egid_arg))
return NULL;
- rgid = rgid_arg;
- egid = egid_arg;
- if (egid != egid_arg || rgid != rgid_arg) {
+ if (rgid_arg == -1)
+ rgid = (gid_t)-1; /* let the compiler choose how -1 fits */
+ else
+ rgid = rgid_arg; /* otherwise, assign from our long */
+ if (egid_arg == -1)
+ egid = (gid_t)-1;
+ else
+ egid = egid_arg;
+ if ((egid_arg != -1 && egid != egid_arg) ||
+ (rgid_arg != -1 && rgid != rgid_arg)) {
PyErr_SetString(PyExc_OverflowError, "group id too big");
return NULL;
}
More information about the Python-checkins
mailing list