[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fix for Zope segfault on amd64



On Sat, Jan 22, 2005 at 04:09:41PM -0500, Per Bojsen wrote:
> This may be true for Linux but I wouldn't be so certain this is true
> for all platforms Zope runs on.

Please be specific then. point one architecture that zope support which
did not fulfill this requirement.

> You're making the assumption that an int is 32-bit or at least large
> enough to contain gid_t on all platforms supported by Zope.  It is
> better to use a long since it is extremely unlikely that gid_t is a
> `bigger' integer type than long on any of the platforms out there.

This is the assumption gcc make actually (int == 32bit) and probably all
sane compiler. maybe not for 16 bit architecture but they are probably
not supported by Zope.

you cannot assume either that long should be big enough to support a gid_t
(even if this likely to be the case for multiple decade and maybe forever...)
Then what about using long long to be sure ? or long long long ? see my point ?

Zope code made it wrong using "sl:initgroups" where it should be
"si:initgroups" (and with that, this is true for all arch, no need for
conditional compilation), as countless developers/programs that assume
sizeof(long) == sizeof(int)

And obviously it breaks on 64 bits arch...

The fix should look something like:

-	if (!PyArg_ParseTuple(args, "sl:initgroups", &username, &gid))
+	if (!PyArg_ParseTuple(args, "si:initgroups", &username, &gid))

-- 
Vincent Hanquez



Reply to: