[Patches] [ python-Patches-488073 ] AtheOS port of Python 2.2b2

noreply@sourceforge.net noreply@sourceforge.net
Mon, 10 Jun 2002 23:27:54 -0700


Patches item #488073, was opened at 2001-12-02 14:57
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=488073&group_id=5470

Category: Build
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 4
Submitted By: Octavian Cerna (tavyc)
Assigned to: Martin v. Löwis (loewis)
Summary: AtheOS port of Python 2.2b2

Initial Comment:
Hi,
 
While I was playing with AtheOS in the last few days, I saw 
that it comes
with Python 1.5.2.  Being a Python enthusiast, I 
tried to see if a recent
version of Python would work.  It did not 
even compile, so I decided to port
it, knowing that AtheOS is 
almost POSIX-compatible.
 
The result is a full-blown Python port 
with only a (relative) small amount
of changes, that builds 
OOTB.
 
And here it is, with all the details:
 
 
About the patch:
 

  - The diff is against CVS 2001-11-26
  - 20 files changed, 1962 
insertions, 23 deletions
  - It does not include changes to 
autoconf-generated files
  - The patch includes a few very small 
fixes not directly related to
    the AtheOS port, but which were 
necessary to ensure the port works OK:
    - setup.py - look for the 
_curses_panel.c file in $srcdir/Modules, not
      in $PWD/Modules 
(otherwise VPATH builds will not build _curses_panel.so)
    - 
Makefile.pre.in - only ranlib *.a files (how will this affect 
other ports?)
    - Tools/freeze/bkfile.py - not all platforms have 
the file.truncate method
    - Tools/scripts/h2py.py - environment-
paths code was made more portable
 
Environment:

  - AtheOS 
0.3.6
  - gcc 2.95.2
  - binutils 2.10
  - glibc 2.1.2

Features:
 
  - 
Dynamic loading of modules
  - Native thread support

Issues:
 
  
Although AtheOS is not a BeOS clone, it is in many ways similar to 
BeOS,
  and some issues from BeOS also apply on AtheOS.
 
  - dlopen is 
not properly implemented, so I had to add support for native
    
dynamic loading.
  - The POSIX threads emulation is almost 
inexistent, so I added support for
    native AtheOS threads.
  - 
AtheOS doesn't support importing symbols in a shared library 
from the
    main executable (the `-export-dynamic' linker flag), so 
the Python core
    must be built as a shared library, like on BeOS.
  - 
mmap is not implemented in AtheOS, the mmap module was disabled
  - 
statvfs is not implemented, os.statvfs and os.fstatvfs 
disabled
  - crypt on AtheOS crashes with SEGV if salt is not "$1$" 
(glibc bug?),
    disabled
  - poll - it seems that poll never returns 
POLLNVAL for an invalid fd
    (hangs), disabled
  - Don't mix 
threading with fork() -- see test_popen2 below.

All tests pass, 
except:
 
  - test_nis hangs on my system, probably because NIS is 
not set up
  - test_popen2 hangs when imported from regrtest.py, 
otherwise working
    (like on BeOS).  I suspect that the import 
semaphore is locked when
    popen2 forks and AtheOS doesn't like 
that.
  - test_mhlib fails, I don't know exactly why, but I suspect a 
filesystem issue
    (It corrupted some of my files several times, 
and I don't want to run it
    again ;)
  - test_locale skipped, locale 
en_US not supported (maybe something's wrong
    with my 
environment?)
  - test_largefile skipped (unless you tell it to 
eat 2GB disk space)
    because apparently afs doesn't support 
sparse files.

Notes:
 
  - If you build Python, make sure you have 
shared versions of your
    libraries and you have links in 
/system/libs for them, otherwise the
    kernel won't load 
modules.
    AtheOS doesn't have a shared version for each library, 
I had serious
    problems with ncurses and the _curses_panel 
module.
 
Binary packages:
 
  - I have prepared binary packages of 
Python-2.2b2 and Numeric-20.2.1
    for testing, I will post them on 
kamidake.org later.
 
Future:
 
  - I'm going to try Zope these 
days, I think it should work with a minimum
    amount of changes, 
almost OOTB ;)
 

(Maybe I should have included this text in the 
README file?)
 
Please excuse my bad English, I am not a native 
speaker :)
 
Python is an excellent language/environment, keep 
going with the good work!
--------
 
Best Regards,
Octavian Cerna 
(Tavy)
yLabs


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2002-06-11 08:27

Message:
Logged In: YES 
user_id=21627

Thanks for the patch, applied as

Makefile.pre.in 1.85
configure 1.313
configure.in 1.323
pyconfig.h.in 1.40
setup.py 1.89
build_ext.py 1.82
IN.py 1.1
TYPES.py 1.1
regen 1.1
regrtest.py 1.86
test_fcntl.py 1.23
test_file.py 1.9
test_mhlib.py 1.7
test_os.py 1.11
test_popen2.py 1.6
ACKS 1.181
AtheOS-NOTES 1.1
NEWS 1.422
cryptmodule.c 2.12
dynload_atheos.c 2.1
thread.c 2.43
thread_atheos.h 2.1
h2py.py 1.17

If you think some of the changes that I left out are still
needed, please submit them as separate patches, with
appropriate autoconf tests.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-06-02 14:14

Message:
Logged In: YES 
user_id=21627

On AF_UNIX: I can see how SocketServer.py will define
UnixStreamServer if AF_UNIX is available, however, I cannot
see why this causes a problem unless somebody uses the
UnixStreamServer. The documentation is, strictly speaking,
still correct even if AF_UNIX was defined, since it only
talks about the case that it isn't defined. The same holds
for AF_INET6 on many systems: The C library may define it,
but the kernel may be configured to not support IPv6.

On statvfs, I recommend to fix the test rather than hiding
the function.

On fseeko: I recommend to activate LFS; perhaps the
documentation should be changed to indicate that this is
known to be broken on AtheOS 0.3.6.

If you think any of these restrictions *must* be
implemented, please implement an autoconf test to detect the
restrictions automatically, rather than testing them based
on the system name.

Otherwise, I can carry out the proposed changes myself
(removal of the restrictions); please indicate which
approach you prefer.

----------------------------------------------------------------------

Comment By: Octavian Cerna (tavyc)
Date: 2002-05-15 13:54

Message:
Logged In: YES 
user_id=382173

- AF_UNIX is undefined because Doc/lib/libsocket.tex 
says: "If the AF_UNIX constant is not defined then this 
protocol is unsupported."  Defining AF_UNIX breaks 
Lib/SocketServer.py as it doesn't handle EAFNOSUPPORT.

- for statvfs I assumed the same convetion, see 
Lib/test/test_os.py
(method StatAttributeTests.test_statvfs_attributes).

- the problem is not with autoconf, but in glibc: 
gnu/stubs.h fails to define __stub_ macros for all 
unimplemented functions (statvfs for example).

- fseeko/ftello don't work at all for large files. 
Small example:

fp = fopen("2.1GB_file", "r"); /*filesize=2307915776LL*/
fseeko(fp, 0LL, 2); /* seeks to eof, returns -1, 
errno=0 */
ftello(fp); /* returns -1987051520LL, which is 
(int32)2307915776LL */
This is a sign truncation problem somewhere in libio.

The lowlevel functions lseek, stat, etc are all OK:
os.stat("2.1GB_file").st_size = 2307915776L

So I preferred to disable largefile support for file 
objects. 
Perl which also uses stdio has the same problem.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-05-12 18:40

Message:
Logged In: YES 
user_id=21627

A few more questions:

- Why is AF_UNIX undefined? I.e. what problems would arise
if it was exported from the socket module?

- Likewise, what problems arise if statvfs is exported from
the Posix module? Sure, calling the function might always
give an exception, but what is the problem with that? 

- Also, are you sure this is still an issue with the current
autoconf? configure specifically checks for the __stub_
symbols defined in glibc for stub functions.

- What problems arise if large file support is enabled? Does
seek/tell not work at all, or does it just fail for large files?

----------------------------------------------------------------------

Comment By: Octavian Cerna (tavyc)
Date: 2002-05-05 20:23

Message:
Logged In: YES 
user_id=382173

Updated to CVS 2002-05-04.

I disabled from setup.py the modules which don't make 
sense on AtheOS (nis for example).

I still used the historic sys.platform[:n] in a few 
places in order to be consistent with the surrounding 
code.

This time I was more careful with the code, and made 
more testing.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-04-20 19:12

Message:
Logged In: YES 
user_id=21627

Can you please update the patch for the current CVS? A few
comments:

- the plat-*/FCNTL are not generated anymore, FCNTL is
deprecated.
- Why does test_nis need to skip explicitly on atheos? If
the nis module builds, why does the test fail?
- Please use the .startswith method over the (historic) [:n]
form when testing sys.platform.
- I don't understand the O_LARGEFILE chunk. What is the
problem with just not defining O_LARGEFILE?


----------------------------------------------------------------------

Comment By: Octavian Cerna (tavyc)
Date: 2001-12-02 19:40

Message:
Logged In: YES 
user_id=382173

I know that Python is now in a "feature freeze" or something similar, but 
this patch could go in Python 2.3.
I added the HAVE_GETADDRINFO to 
acconfig.h because it was simply missing and autoheader complained, 
(outdated CVS snapshot). I should have removed it from the patch. I 
posted it here just to make it available to anyone who wants to try it 
out.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-12-02 16:42

Message:
Logged In: YES 
user_id=21627

I'd advise not to add this port so shortly before 2.2, in
particular since these changes need careful review. As an
example: Why does it add HAVE_GETADDRINFO to acconfig.h?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=488073&group_id=5470