-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ptyprocess fails on OpenIndiana 151a9 and Python 2.7.11 when the process lacks a controlling terminal #34
Comments
Here's a minimal reproduction case:
if you comment out the first block (os.fork to os.setsid), it works. Otherwise, you get:
|
My workaround is to issue os.openpty() just before the call to pexpect.spawn() so the parent process gets a bogus controlling terminal and does not attempt to steal its' child's, but that is obviously quite ugly. |
Opened an issue with Illumos: https://www.illumos.org/issues/6995 |
It sounds like the issue is occuring inside the call to |
Hello, I'm familiar with Illumos/OpenSolaris, and have attempt to provide build stability for this OS in the past -- the cost of joyent containers was too high to maintain for the long term. If only travis-ci could provide OpenSolaris support :) The core Python project itself has similar issue, they are not supporting Solaris very well any longer due to lack of build infrastructure and core contributors with solaris experience. From what I recall about stagnated pty.fork() fixes in the bug tracker, there is not interest in resolving pty.fork() for Solaris, they do not have the resources to test it. This issue smells very familiar to a previous one: Which from the various related PR's and Issues, we thought was addressed. Just a memory dump:
(edit: i kept saying os.fork() but meant pty.fork() of course!) |
@jquast
What are the "pty C libraries" that work perfectly fine on Solaris you are referring to? I could look into how they avoid the issue os.openpty() is experiencing and see if that could be backported into Python. |
As we are trying to resurrect Solaris port of Sagemath, more precisely a SPARC Solaris 11 --- it used to work back in 2011 or so--- it appears that pexpect/ptyprocess is a stumbling block. We see at lot of How hard would be to work around this pexpect limitation? (We could patch Python if needed...) |
@dimpase The |
Perhaps a better error message would be to add something like |
We have the same problem (/dev/tty) on Solaris 10 :( |
basically, we just don't call |
Have you meant "echo=False" ? If so - it doesn't work on Solaris 10. |
Can you please state exactly which problem you have. |
|
I have exactly the same problem as @fazalmajid had and his example gives the same result on Solaris 10 (it can be reproduced in any time). "OSError: [Errno 6] No such device or address: '/dev/tty'" That is why I wrote in brackets "/dev/tty".
|
Traceback please... |
If you have access to a Solaris 10 system, which I do not have. If you want me to help you, then you will need to give more information. |
Sorry for the mess. This ticket is about two things and I got totally confused. Because of the comments by @dimpase I was thinking that it was about |
pexpect is failing in ptyprocess.spawn on OpenIndiana 151a9 (a distro of Illumos/OpenSolaris). pexpect is 4.1.0, ptyprocess is 0.5.1:
The script is run under the control of
at(1)
, and the job itself is queued from a crontab. It looks like what is happening is that when the parent process, which has no controlling terminal, calls os.openpty(), it acquires the pty as a controlling terminal. The problem seems to occur when posix_openpty pushes the ptem STREAMS module onto the slave pty fd, the simple callioctl(slave_fd, I_PUSH, "ptem")
causes the parent process to acquire the pty as its controlling terminal, and thus the child, which is in a different session, is unable to acquire it and the failure at line 76 in _fork_pty().I diffed posixmodule.c on Python 3.5 vs 2.7.11, the implementation of posix_openpty is not much different.
Older versions of pexpect had a different implementation _svr4_openpty(), but those look very similar to the Python posixmodule.c code.
The text was updated successfully, but these errors were encountered: