Skip to content
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

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ To avail of fixes in an unreleased version, please download a ZIP file
Unreleased
----------

* :gh:issue:`950` Fix Solaris/Illumos/SmartOS compatibility with become
* :gh:issue:`1087` Fix :exc:`mitogen.core.StreamError` when Ansible template
module is called with a ``dest:`` filename that has an extension
* :gh:issue:`1110` Fix :exc:`mitogen.core.StreamError` when Ansible copy
Expand Down
7 changes: 5 additions & 2 deletions mitogen/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def _ioctl_cast(n):
LINUX_TIOCSPTLCK = _ioctl_cast(1074025521)

IS_LINUX = os.uname()[0] == 'Linux'
IS_SOLARIS = os.uname()[0] == 'SunOS'
moreati marked this conversation as resolved.
Show resolved Hide resolved


SIGNAL_BY_NUM = dict(
(getattr(signal, name), name)
Expand Down Expand Up @@ -411,7 +413,7 @@ def _acquire_controlling_tty():
# On Linux, the controlling tty becomes the first tty opened by a
# process lacking any prior tty.
os.close(os.open(os.ttyname(2), os.O_RDWR))
if hasattr(termios, 'TIOCSCTTY') and not mitogen.core.IS_WSL:
if hasattr(termios, 'TIOCSCTTY') and not mitogen.core.IS_WSL and not IS_SOLARIS:
# #550: prehistoric WSL does not like TIOCSCTTY.
# On BSD an explicit ioctl is required. For some inexplicable reason,
# Python 2.6 on Travis also requires it.
Expand Down Expand Up @@ -479,7 +481,8 @@ def openpty():

master_fp = os.fdopen(master_fd, 'r+b', 0)
slave_fp = os.fdopen(slave_fd, 'r+b', 0)
disable_echo(master_fd)
if not IS_SOLARIS:
disable_echo(master_fd)
disable_echo(slave_fd)
moreati marked this conversation as resolved.
Show resolved Hide resolved
mitogen.core.set_block(slave_fd)
return master_fp, slave_fp
Expand Down
Loading