[ python-Bugs-1048808 ] test_subprocess 2.4b1 fails on FreeBSD 5.2
SourceForge.net
noreply at sourceforge.net
Wed Oct 20 19:23:49 CEST 2004
Bugs item #1048808, was opened at 2004-10-17 21:24
Message generated for change (Comment added) made by effbot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1048808&group_id=5470
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 7
Submitted By: Shalabh Chaturvedi (shalabh)
Assigned to: Peter Åstrand (astrand)
Summary: test_subprocess 2.4b1 fails on FreeBSD 5.2
Initial Comment:
Platform: FreeBSD 5.2.1-RELEASE
Python version: 2.4b1
After untarring I just did 'make' and then 'make test'.
make test passes all except following (output of make
test):
----
test_subprocess
this bit of output is from a test of stdout in a
different process ...
test test_subprocess failed -- Traceback (most recent
call last):
File
"/usr/home/shalabh/down/Python-2.4b1/Lib/test/test_subprocess.py",
line 432, in test_close_fds
self.assertEqual(p.stdout.read(), "3")
AssertionError: '5' != '3'
----
Also, make test ends with:
----
*** Error code 1
Stop in /usr/home/shalabh/down/Python-2.4b1.
----
Don't know if above is expected when a test fails.
----------------------------------------------------------------------
>Comment By: Fredrik Lundh (effbot)
Date: 2004-10-20 19:23
Message:
Logged In: YES
user_id=38376
Just curious, but what happens if you start Python using the -
S option:
$ python -S
>>> import os
>>> os.dup(0)
----------------------------------------------------------------------
Comment By: Peter Åstrand (astrand)
Date: 2004-10-20 15:06
Message:
Logged In: YES
user_id=344921
>>> import os
>>> os.dup(0)
5
I think this is the core of the problem. The test_close_fds
test works like this:
All file descriptors in the forked child (except 0,1,2) are
closed. Then the Python binary is executed via execvp(). A
small test program is passed to the Python binary via the -c
command line option. If the OS and subprocess module works
correctly, we can be sure of that by the time of the
execve() system call, only file descriptors (0,1,2) are open
(well, the errpipe as well, but let's leave that out for
now). But, by the time the Python binary starts executing
the small program, all sorts of things may have happened.
I'm not really sure we can trust Python not to open files
during startup. For example, if we have a PYTHONSTARTUP
file, that open file will have a file descriptor, perhaps 3.
On one hand, this bug could indicate a bug in the Python
interpreter itself: perhaps a file descriptor leak. On the
other hand, this test might be a bit too unsafe.
So probably, this test should be removed.
----------------------------------------------------------------------
Comment By: Shalabh Chaturvedi (shalabh)
Date: 2004-10-17 23:06
Message:
Logged In: YES
user_id=30293
Here's some more info. On my FreeBSD box, for both 2.3.4 and
2.4b1:
>>> import os
>>> os.dup(0)
5
But on my Win XP box for 2.3.3:
>>> import os
>>> os.dup(0)
3
I am guessing this may be relevant. Someone more
knowledgable can comment.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1048808&group_id=5470
More information about the Python-bugs-list
mailing list