[New-bugs-announce] [issue5895] socketmodule.c on HPUX ia64 without _XOPEN_SOURCE_EXTENDED compiles incorrectly

Naoyuki Tai report at bugs.python.org
Fri May 1 18:37:54 CEST 2009

New submission from Naoyuki Tai <ntai at users.sourceforge.net>:

Python can build without _XOPEN_SOURCE_EXTENDED on HPUX ia64 but the
socket module is bust.
This is because APIs like getsockname() do not use socklen_t*. Instead
it is defined using int* for some of arguments.
In socketmodule.c, it consistently use socklent_t which is the right
thing for the rest of world.
Because socklent_t is 64bit (same as size_t) and int is 32bit, it
compiles with warnings of different types of pointer but it compiles anyway.
The result is that, getsockname(), etc. take a look at the 32bit out of
64bit value thinking it is "zero" (big endian machine).
APIs succeed without error but the result does not come back since the
API calls think that the return value buffer size is 0.

My Python build is 2.5. I think the same is true for all versions
thereafter. I wish I could give you a diff but I don't know well enough
the socketmodule.c what's the right thing to do.
I cannot use _XOPEN_SOURCE_EXTENDED as I have other python bindings and
modules built without _XOPEN_SOURCE_EXTENDED.

components: Extension Modules
messages: 86889
nosy: ntai
severity: normal
status: open
title: socketmodule.c  on HPUX ia64 without _XOPEN_SOURCE_EXTENDED compiles incorrectly
type: compile error
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list