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

Fall back to TCGETS if TCGETS2 fails #1147

Merged
merged 16 commits into from
Sep 5, 2024
Merged

Conversation

sunfishcode
Copy link
Member

Switch tcgetattr/tcsetattr from using TCGETS2/TCSETS2 first to using TCGETS/TCSETS first. Have tcgetattr fall back to TCGETS2 if the TCGETS flags indicate that a custom speed is in used.

glibc and musl have not yet migrated to TCGETS2/TCSETS2, and as a result, seccomp sandboxes and Linux-like environments such as WSL don't always support them.

Also, fix some bugs in QEMU related to the handling of termios syscalls. This eliminates the need for having rustix do extra fixups on PowerPC.

This is expected to fix crossterm-rs/crossterm#912.

Switch `tcgetattr`/`tcsetattr` from using `TCGETS2`/`TCSETS2` first to using
`TCGETS`/`TCSETS` first. Have `tcgetattr` fall back to `TCGETS2` if the
`TCGETS` flags indicate that a custom speed is in used.

glibc and musl have not yet migrated to `TCGETS2`/`TCSETS2`, and as a
result, seccomp sandboxes and Linux-like environments such as WSL don't always
support them.

Also, fix some bugs in QEMU related to the handling of termios syscalls.
This eliminates the need for having rustix do extra fixups on PowerPC.

This is expected to fix crossterm-rs/crossterm#912.
@sunfishcode sunfishcode force-pushed the sunfishcode/tcgets-new branch from a1ce30f to c4ef05f Compare September 5, 2024 02:39
@sunfishcode sunfishcode changed the title Try TCGETS before trying TCGETS2. Fall back to TCGETS if TCGETS2 fails Sep 5, 2024
@sunfishcode sunfishcode merged commit 16dcb8d into main Sep 5, 2024
43 checks passed
@sunfishcode sunfishcode deleted the sunfishcode/tcgets-new branch September 5, 2024 12:39
@sunfishcode
Copy link
Member Author

This is now released in rustix 0.38.36.

fornwall added a commit to termux/termux-packages that referenced this pull request Sep 5, 2024
fornwall added a commit to termux/termux-packages that referenced this pull request Sep 5, 2024
termux-pacman-bot added a commit to termux-pacman/termux-packages that referenced this pull request Sep 5, 2024
fornwall added a commit to fornwall/nushell that referenced this pull request Sep 19, 2024
Notable this gets bytecodealliance/rustix#1147
which makes things work on Android again.
fornwall added a commit to fornwall/broot that referenced this pull request Sep 19, 2024
This gets bytecodealliance/rustix#1147, a fix
that makes things work on Android again (see Canop#940 - this is the patch
Termux carries when building latest broot).
fornwall added a commit to fornwall/nushell that referenced this pull request Sep 26, 2024
Notable this gets bytecodealliance/rustix#1147
which makes things work on Android again.
sholderbach pushed a commit to nushell/nushell that referenced this pull request Sep 26, 2024
Notable this gets bytecodealliance/rustix#1147
which makes things work on Android again.

Without this update latest `0.98.0` release gets stuck in a loop
outputting the below error due to the `TCGETS2` usage:

> Error: Os { code: 13, kind: PermissionDenied, message: "Permission
denied" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable_raw_mode() error in version 0.28.0 under WSL and Android
1 participant