FreeBSD fails fork_pty: OSError: [Errno 6] Device not configured: '/dev/tty'
jquast opened this issue · 5 comments
Got a FreeBSD (digital ocean droplet, freebsd.pexpect.org
) build agent prepared. It raises exception very early in critical codepath causing test runner to fork and eventually the build agent is killed by the kernel due to an OOM condition.
Error is in method pty_make_controlling_tty
at:
# Verify we now have a controlling tty.
fd = os.open("/dev/tty", os.O_WRONLY)
[freebsd@freebsd ~]$ sudo -u teamcity -s
$ cd /opt/TeamCity/work/210ae16cc3f30c30/ptyprocess
$ . `which virtualenvwrapper.sh`
$ mkvirtualenv pexpect27 --python=`which python2.7`
$ pip install -e .
$ cd ../pexpect
$ python
Python 2.7.9 (default, Jan 8 2015, 21:47:19)
[GCC 4.2.1 Compatible FreeBSD Clang 3.3 (tags/RELEASE_33/final 183502)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import pexpect
>>> bash = pexpect.spawn('/bin/bash')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pexpect/pty_spawn.py", line 189, in __init__
self._spawn(command, args, preexec_fn)
File "pexpect/pty_spawn.py", line 281, in _spawn
cwd=self.cwd, **kwargs)
File "/opt/TeamCity/work/210ae16cc3f30c30/ptyprocess/ptyprocess/ptyprocess.py", line 220, in spawn
pid, fd = _fork_pty.fork_pty()
File "/opt/TeamCity/work/210ae16cc3f30c30/ptyprocess/ptyprocess/_fork_pty.py", line 30, in fork_pty
pty_make_controlling_tty(child_fd)
File "/opt/TeamCity/work/210ae16cc3f30c30/ptyprocess/ptyprocess/_fork_pty.py", line 76, in pty_make_controlling_tty
fd = os.open("/dev/tty", os.O_WRONLY)
OSError: [Errno 6] Device not configured: '/dev/tty'
/dev/tty
may be opened under normal conditions.
May be:
_is_solaris = not (
_platform.startswith('solaris') or
_platform.startswith('sunos'))
This variable is backwards from its name: on a Solaris system _is_solaris
becomes False.
Therefore, FreeBSD is using the custom _fork_pty.fork_pty()
function meant for Solaris.
Well spotted. I've removed the not
; does that work on FreeBSD now?
It does, discovering strange things about IMAXBEL on FreeBSD and working with those, now.
I did make branch _is_solaris-badval
that does the same also, I will remove it. Just bumped the version, added a few more classifiers, and adds unix \n at EOF (my editor can't help it)
make sure to cut a new release for us to pypi
@takluyver could you please release a new version (maybe 0.4.1) on pypi, so that we won't need the patch that was committed a month ago?