Fix for Zope segfault on amd64
Hi,
I did some debugging and found out that the segfault in Zope on amd64
is due to some non-64-bit-compatible code in the initgroups.c source
file (lib/Components/initgroups/initgroups.c in the Zope source
package). Here is a patch that fixes this problem:
--- initgroups.c~ 2002-07-25 17:54:02.000000000 -0400
+++ initgroups.c 2005-01-22 01:36:44.422203184 -0500
@@ -25,7 +25,16 @@
char *username;
gid_t gid;
+#if defined(__x86_64__) || defined(__amd64) || defined(__amd64__)
+ /* gid_t is a 32-bit integer on amd64 so we should use the i
+ format specifier as the l specifier indicates a long which
+ is 64 bits. This fixes a segfault caused by
+ PyArg_ParseTuple() overwriting the lower 32 bits of
+ username when setting gid. */
+ if (!PyArg_ParseTuple(args, "si:initgroups", &username, &gid))
+#else
if (!PyArg_ParseTuple(args, "sl:initgroups", &username, &gid))
+#endif
return NULL;
if (initgroups(username, gid) == -1)
With this patch I no longer get segfaults and I am able to bring up
the Zope management interface.
Hope this helps,
Per
--
Per Bojsen <per.bojsen@comcast.net>
7 Francis Road
Billerica, MA 01821-3618
USA
Reply to: