1 |
Author: zmedico |
2 |
Date: 2010-03-02 03:54:17 +0000 (Tue, 02 Mar 2010) |
3 |
New Revision: 15512 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/package/ebuild/_pty.py |
7 |
Log: |
8 |
Test for python openpty breakage after freebsd7 to freebsd8 upgrade, which |
9 |
results in a 'Function not implemented' error and the process being killed. |
10 |
Thanks to Javier Villavicenciom <the_paya@g.o> for reporting and helping to |
11 |
develop this test. |
12 |
|
13 |
|
14 |
Modified: main/trunk/pym/portage/package/ebuild/_pty.py |
15 |
=================================================================== |
16 |
--- main/trunk/pym/portage/package/ebuild/_pty.py 2010-03-01 08:14:33 UTC (rev 15511) |
17 |
+++ main/trunk/pym/portage/package/ebuild/_pty.py 2010-03-02 03:54:17 UTC (rev 15512) |
18 |
@@ -132,6 +132,8 @@ |
19 |
# Skip _test_pty_eof() on systems where it hangs. |
20 |
_tested_pty = True |
21 |
|
22 |
+_fbsd_test_pty = platform.system() == 'FreeBSD' |
23 |
+ |
24 |
def _create_pty_or_pipe(copy_term_size=None): |
25 |
""" |
26 |
Try to create a pty and if then fails then create a normal |
27 |
@@ -148,7 +150,7 @@ |
28 |
|
29 |
got_pty = False |
30 |
|
31 |
- global _disable_openpty, _tested_pty |
32 |
+ global _disable_openpty, _fbsd_test_pty, _tested_pty |
33 |
if not (_tested_pty or _disable_openpty): |
34 |
try: |
35 |
if not _test_pty_eof(): |
36 |
@@ -160,6 +162,19 @@ |
37 |
del e |
38 |
_tested_pty = True |
39 |
|
40 |
+ if _fbsd_test_pty and not _disable_openpty: |
41 |
+ # Test for python openpty breakage after freebsd7 to freebsd8 |
42 |
+ # upgrade, which results in a 'Function not implemented' error |
43 |
+ # and the process being killed. |
44 |
+ pid = os.fork() |
45 |
+ if pid == 0: |
46 |
+ pty.openpty() |
47 |
+ os._exit(os.EX_OK) |
48 |
+ pid, status = os.waitpid(pid, 0) |
49 |
+ if (status & 0xff) == 140: |
50 |
+ _disable_openpty = True |
51 |
+ _fbsd_test_pty = False |
52 |
+ |
53 |
if _disable_openpty: |
54 |
master_fd, slave_fd = os.pipe() |
55 |
else: |