[Patches] [ python-Patches-1284289 ] AIX port from Elemental Security

SourceForge.net noreply at sourceforge.net
Wed Sep 14 20:16:05 CEST 2005

Patches item #1284289, was opened at 2005-09-07 16:56
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.4
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: AIX port from Elemental Security

Initial Comment:
Note: don't commit this until the contribution
paperwork has been submitted.

These are patches to make Python 2.4.1 compile and run
(mostly) on AIX 5.3 ML2. (I should know the hardware
platform but I'm completely ignorant of that kind of

The patches were created by Monte Davidoff and paid for
by Elemental Security.


>Comment By: Guido van Rossum (gvanrossum)
Date: 2005-09-14 14:16

Logged In: YES 

Checked in for 2.4.2 and HEAD.

Elemental Security has mailed a signed contributor form to
the PSF.


Comment By: Neal Norwitz (nnorwitz)
Date: 2005-09-07 17:15

Logged In: YES 

There is another patch to correct pwdmodule.c and
grpmodule.c using unsigned values.  I haven't looked at
either patch (that one or this one) in detail just the comments.


105470 has 2 one line changes to convert i -> I.  This is
from the comments.


Comment By: Guido van Rossum (gvanrossum)
Date: 2005-09-07 16:59

Logged In: YES 

Here are Monte's notes.

Python was configured using:

    ./configure --with-gcc='xlc_r -q64' --with-cxx='xlC_r
-q64'                 --disable-ipv6 AR='ar -q64'

Eventhough xlc_r is not gcc, configure produced better
results when
--with-gcc was used.

IPv6 was disabled, because configure reported that
getaddrinfo() was
buggy, and, at this time, Elemental Security does not
require IPv6.

Note: the test suite still fails on: test_codecencodings_cn,
test_codecmaps_cn, test_curses, test_mmap, and
as Elemental Security did not require these features.  All
other tests
in the test suite that were not skipped passed.

These source changes were required:


This script uses nm to create an export list of global
symbols for
the AIX dynamic linker.  Changed the script to include the
nm -X32_64
option, which allows it to process both 32-bit and 64-bit
object files.
For backward compatibility, this option is added only if the
nm command
implements the option.


These files were modified to reallocate the import lock in
the child
process after a fork.  This prevents the child process from
EACCES when performing operations on the import lock.

Include/import.h -- added prototype for _PyImport_ReInitLock.

Python/import.c -- added _PyImport_ReInitLock.  This
function was
modeled after PyEval_ReInitThreads, which serves a similar
The _PyImport_ReInitLock function reallocates the import_lock,
if the import_lock has already been allocated.  The code within
_PyImport_ReInitLock is under #ifdef _AIX.

Modules/signalmodule.c -- added call to _PyImport_ReInitLock in


These files were modified to fix a memory corruption problem
AF_UNIX sockets.  AIX's struct sockaddr_un structure contains a
path name which is the address of a UNIX socket.  Unlike several
other flavors of UNIX-like systems, the AIX declaration for
sockaddr_un actually allocates enough space for any path
name (PATH_MAX).
This means a struct sockaddr_un takes up 1025 bytes. 
However, several
places in socketmodule.c allocated only 256 bytes for a
socket address.
The first thing they do with the 256-byte socket address
buffer is zero
1025 bytes.  Not good!

Modules/socketmodule.h -- the PySocketSockObject typedef
already defined
a union sock_addr that allocates enough space for any socket
Moved the union outside the PySocketSockObject struct into
its own
typedef, sock_addr_t.

Modules/socketmodule.c -- replaced the "char addrbuf[256]"
with "sock_addr_t addrbuf" and made other changes required
by that.


UIDs and GIDs are unsigned.  Changed pwd_getpwuid and
grp_getgrgid to
accept unsigned UIDs and GIDs.  On AIX, the passwd and group
files use
the largest unsigned int for nobody.

Lib/test/test_ioctl.py -- Fixed bug in import statement for
test.test_support.  Fixed bug where the test would fail if
the test suite
was being run in the backgroud.  In this case, the TIOCGPGRP
ioctl on
/dev/tty returns the session ID, not the process group ID.

Lib/test/regrtest.py -- added skips for aix5.


You can respond by visiting: 

More information about the Patches mailing list