-
Notifications
You must be signed in to change notification settings - Fork 199
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
Fix: termios.error: (22, 'Invalid argument') during become
on Solaris/Illumos/SmartOS
#1089
Conversation
hmmm I tried the patch and it did not suffice to make things work ... what I did find was that probably the
I also tried a patch to make cfmakeraw happier: def cfmakeraw(tflags):
"""
Given a list returned by :py:func:`termios.tcgetattr`, return a list
modified in a manner similar to the `cfmakeraw()` C library function, but
additionally disabling local echo.
"""
# BSD: github.com/freebsd/freebsd/blob/master/lib/libc/gen/termios.c#L162
# Linux: github.com/lattera/glibc/blob/master/termios/cfmakeraw.c#L20
iflag, oflag, cflag, lflag, ispeed, ospeed, cc = tflags
if IS_SOLARIS:
iflag &= ~flags('IGNBRK BRKINT PARMRK ISTRIP INLCR IGNCR ICRNL IXON')
oflag &= ~flags('OPOST')
lflag &= ~flags('ECHO ECHONL ICANON ISIG IEXTEN')
cflag &= ~flags('CSIZE PARENB')
cflag |= flags('CS8')
else:
iflag &= ~flags('IMAXBEL IXOFF INPCK BRKINT PARMRK '
'ISTRIP INLCR ICRNL IXON IGNPAR')
iflag &= ~flags('IGNBRK BRKINT PARMRK')
oflag &= ~flags('OPOST')
lflag &= ~flags('ECHO ECHOE ECHOK ECHONL ICANON ISIG '
'IEXTEN NOFLSH TOSTOP PENDIN')
cflag &= ~flags('CSIZE PARENB')
cflag |= flags('CS8 CREAD')
return [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] but because of the cookie problem I did not see whether this helped any |
@oetiker Interesting failure mode. What's the context of the test you were doing where |
I reran my tests on Ansible 2.15.12 and was seeing the same success. Although maybe you are seeing a completely different problem that I was here. |
yes I am pretty sure my problem is a different one ... maybe related to a different range for process ids on solaris or some such ? |
What Solaris or derivative are you running? We're running SmartOS and I'm not seeing crashes in |
Notes to myself,
Other
Questions to ponder (answers are not required to merge this)
|
become
on Solaris/Illumos/SmartOS
@moreati : not sure what is causing these CI failures, but they don't seem directly related to (or unique to) this patch. |
They're due to #1058, almost certainly unrelated to your change. To re-run tests for a PR add a comment containing
Edit: I can also rerun failed jobs within CI run. I'll do so now. |
@moreati Any other requests for this one now that it's passing checks? |
Yes. Two suggested changes are still open (see previous comments), and I want to answer "what are the consequences of leaving echo enabled?" before merging. |
The reason I asked is that I looked through the comments here and believe that I have answered the questions or have addressed them in code. If you can give me a reference to the outstanding suggested changes, I'll gladly address them. Sorry if I'm being dense here. The question of "what are the consequences of leaving echo enabled?" isn't quite the question for Solaris. In the case of mitogen, you're disabling echo on both sides of the pty, which works in linux. For Solaris, the pty is streams-based and because of the way it works, the |
Oddly enough, I don't see that on my screen, and searching for those words on the page doesn't find them either. With that said, let me apply the patches. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still can't find primary documentation that clearly states Solaris-likes only accept the slave fd for tcgetattr()
and tcsetattr()
, but the exerimental evidence has me satisfied.
This fixes compatibility with Solaris/Illumos/SmartOS, addressing an issue that shows up most frequently with become. The issue was mostly due to differences in how the TTY driver is handled and the pty driver not supporting echo on both sides of the pipe (as designed, from a Solaris point of view).
Fixes #950