-
Notifications
You must be signed in to change notification settings - Fork 669
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
On illumos tcsetattr() is unusably buggy as it truncates termios fields #2071
Comments
The termios interface from the nix crate is lacking a thought through design. Severely broken on at least one platform. Please see [#2071][] for details. The termios crate stays closer to the C API and thus both works with illumos and reduces the risk of bugs on other platforms. [#2071]: nix-rust/nix#2071
The termios interface from the nix crate is lacking a thought through design. Severely broken on at least one platform. Please see [#2071][] for details. The termios crate stays closer to the C API and thus both works with illumos and reduces the risk of bugs on other platforms. [#2071]: nix-rust/nix#2071
Adding missing flags to libc isn't very hard. It's much easier than adding illumos CI. So that's certainly the path of least resistance. It isn't future-proof, however, as it could be broken by future Illumos releases that add new flags. Passing through the exact Disabling termios on illumos would be slightly sad, but only slightly. I would accept that if you really don't have time or ability to add the additional flags to libc. |
Thanks for your involved response and for actively maintaining this crate! It seems we agree the best fix would be to adapt the methods to be gentle with unknown bits. Given the man page quote above, I believe that is the only way to make the API safe on illumos. Since making Unfortunately my time for this is also a bit sparse, but I'll make an attempt at a PR during next week. Then we'll see if it becomes good enough for inclusion, or if we'll have to settle with the unsettling alternative of disabling illumos support. |
Don't worry about breaking changes. Nix isn't 1.0 , so we can and do make those from time to time. |
I've pushed the two branches fix/disable_tcsetattr_illumos and fix/safe_termios, but they are not at all tested. The test suites seem to pass without adding any new failures, but I have no code to do sanely validate the functionality with. Since I'm not a direct consumer of the nix crate, and the crate which made me encounter the problem has conflicting outdated dependencies, I'm afraid it seems to be a bit too much and too fiddly work for me to bring this to completion. With the original C struct already stored in Termios, I believe the fix could actually be as simple as merely preserving the original flags as attempted on the fix/safe_termios branch, but I might need to leave this issue percolating until someone actually able to verify it happens to pass along. Should I post the illumos-disabling branch to a PR, or what seems like the best way forward? |
I am not an Illumos user, and I'm not an expert on the termios API either. If you don't have time to finish that branch, then we can't merge it. But if the current code is useless on Illumos, then sure we can merge a PR to disable it. |
Attempting to run:
will output something like:
Please notice two things:
Quoting tcsetattr (3C):
There are also other relevant sections in the manual, but the bottom line is that
tcsetattr()
practically always close the terminal when called on illumos as currently implemented.I can think of three ways to improve the current situation:
tcsetattr()
on illumos.Given the state of #935 and rust-lang/libc#1405, the first alternative does not seems likely to happen any time soon. The second alternative seems pragmatic, but would be a bit messy both to implement and maintain. The third alternative seems less desired than actually fixing the functionality.
I could do a PR to remove
tcsetattr()
(or rather the entire termios module?) on illumos, unless someone has a better feasible idea.The text was updated successfully, but these errors were encountered: