diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-03-02 21:13:58 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-03-02 21:13:58 +0000 |
commit | 538a7d5cde0f394eeee4dfcfa7f38c6e416e8c29 (patch) | |
tree | 2c7acce3da7ef8869824ccf76add0f6af701cf4c | |
parent | Fix legacy globals proxies to reset state when the portage module is reloaded. (diff) | |
download | portage-538a7d5cde0f394eeee4dfcfa7f38c6e416e8c29.tar.gz portage-538a7d5cde0f394eeee4dfcfa7f38c6e416e8c29.tar.bz2 portage-538a7d5cde0f394eeee4dfcfa7f38c6e416e8c29.zip |
Test for python openpty breakage after freebsd7 to freebsd8 upgrade, which
results in a 'Function not implemented' error and the process being killed.
Thanks to Javier Villavicenciom <the_paya@g.o> for reporting and helping to
develop this test. (trunk r15512)
svn path=/main/branches/2.1.7/; revision=15710
-rw-r--r-- | pym/portage/package/ebuild/_pty.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/pym/portage/package/ebuild/_pty.py b/pym/portage/package/ebuild/_pty.py index 7cc1e4422..f67ca09c4 100644 --- a/pym/portage/package/ebuild/_pty.py +++ b/pym/portage/package/ebuild/_pty.py @@ -132,6 +132,8 @@ if not _can_test_pty_eof(): # Skip _test_pty_eof() on systems where it hangs. _tested_pty = True +_fbsd_test_pty = platform.system() == 'FreeBSD' + def _create_pty_or_pipe(copy_term_size=None): """ Try to create a pty and if then fails then create a normal @@ -148,7 +150,7 @@ def _create_pty_or_pipe(copy_term_size=None): got_pty = False - global _disable_openpty, _tested_pty + global _disable_openpty, _fbsd_test_pty, _tested_pty if not (_tested_pty or _disable_openpty): try: if not _test_pty_eof(): @@ -160,6 +162,19 @@ def _create_pty_or_pipe(copy_term_size=None): del e _tested_pty = True + if _fbsd_test_pty and not _disable_openpty: + # Test for python openpty breakage after freebsd7 to freebsd8 + # upgrade, which results in a 'Function not implemented' error + # and the process being killed. + pid = os.fork() + if pid == 0: + pty.openpty() + os._exit(os.EX_OK) + pid, status = os.waitpid(pid, 0) + if (status & 0xff) == 140: + _disable_openpty = True + _fbsd_test_pty = False + if _disable_openpty: master_fd, slave_fd = os.pipe() else: |