Author heffler
Recipients
Date 2005-08-11.18:19:11
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=298758

I think I figued out the problem with python handling uids and 
gids greater than 2147483647 when using the grp.getgrgid 
and pwd.getpwuid functions. Both of the functions call 
PyArg_ParseTuple with a type of "i", thus indicating the 
argument is a signed integer. Instead they should be 
using "I" (upper-case i) for an unsigned integer. The fix is 
fairly simple. Here are the two patches necessary to the 
python source:

diff -Naur Python-2.4.orig/Modules/grpmodule.c Python-
2.4/Modules/grpmodule.c
--- Python-2.4.orig/Modules/grpmodule.c 2004-01-20 
16:06:00.000000000 -0500
+++ Python-2.4/Modules/grpmodule.c      2005-08-11 
13:36:48.000000000 -0400
@@ -87,7 +87,7 @@
 {
     int gid;
     struct group *p;
-    if (!PyArg_ParseTuple(args, "i:getgrgid", &gid))
+    if (!PyArg_ParseTuple(args, "I:getgrgid", &gid))
         return NULL;
     if ((p = getgrgid(gid)) == NULL) {
        PyErr_Format(PyExc_KeyError, "getgrgid(): gid not 
found: %d", gid);

diff -Naur Python-2.4.orig/Modules/pwdmodule.c Python-
2.4/Modules/pwdmodule.c
--- Python-2.4.orig/Modules/pwdmodule.c 2004-01-20 
16:07:23.000000000 -0500
+++ Python-2.4/Modules/pwdmodule.c      2005-08-11 
13:36:27.000000000 -0400
@@ -104,7 +104,7 @@
 {
        int uid;
        struct passwd *p;
-       if (!PyArg_ParseTuple(args, "i:getpwuid", &uid))
+       if (!PyArg_ParseTuple(args, "I:getpwuid", &uid))
                return NULL;
        if ((p = getpwuid(uid)) == NULL) {
                PyErr_Format(PyExc_KeyError,

Hopefully, someone from the python project can verify my 
patch and get it incorporated into a future release.
History
Date User Action Args
2007-08-23 14:27:29adminlinkissue1066546 messages
2007-08-23 14:27:29admincreate