aports/community/uutils/ppc64le_patch
omni 768bc6110f community/uutils: upgrade to 0.6.0
- allow this to continue as /usr/bin/uutils
- remove now obsolete -stat subpackage
- on loongarch64: downgrade rlimit & libc crates (libc crate issue)
- on s390x: downgrade rlimit & libc crates (nix crate issue)
- on ppc64le: revert breaking uu_stty change
2026-02-04 10:41:29 +00:00

66 lines
2.4 KiB
Plaintext

Revert "stty: Don't panic when GNU provided stty 51 us (#10526)"
This reverts commit e697d123511428cbee1014f319a1964c1872c5d8.
TODO: research ppc64le termios status
https://github.com/uutils/coreutils/issues/10672
--- a/src/uu/stty/src/stty.rs
+++ b/src/uu/stty/src/stty.rs
@@ -12,7 +12,6 @@
// spell-checker:ignore sigquit sigtstp
// spell-checker:ignore cbreak decctlq evenp litout oddp tcsadrain exta extb NCCS cfsetispeed
// spell-checker:ignore notaflag notacombo notabaud
-// spell-checker:ignore baudrate TCGETS
mod flags;
@@ -20,13 +19,9 @@ use crate::flags::AllFlags;
use crate::flags::COMBINATION_SETTINGS;
use clap::{Arg, ArgAction, ArgMatches, Command};
use nix::libc::{O_NONBLOCK, TIOCGWINSZ, TIOCSWINSZ, c_ushort};
-
-#[cfg(target_os = "linux")]
-use nix::libc::{TCGETS2, termios2};
-
use nix::sys::termios::{
ControlFlags, InputFlags, LocalFlags, OutputFlags, SetArg, SpecialCharacterIndices as S,
- Termios, cfsetispeed, cfsetospeed, tcgetattr, tcsetattr,
+ Termios, cfgetospeed, cfsetispeed, cfsetospeed, tcgetattr, tcsetattr,
};
use nix::{ioctl_read_bad, ioctl_write_ptr_bad};
use std::cmp::Ordering;
@@ -618,27 +613,16 @@ fn print_terminal_size(
window_size: Option<&TermSize>,
term_size: Option<&TermSize>,
) -> nix::Result<()> {
- // GNU linked against glibc 2.42 provides us baudrate 51 which panics cfgetospeed
- #[cfg(not(target_os = "linux"))]
- let speed = nix::sys::termios::cfgetospeed(termios);
- #[cfg(target_os = "linux")]
- ioctl_read_bad!(tcgets2, TCGETS2, termios2);
- #[cfg(target_os = "linux")]
- let speed = {
- let mut t2 = unsafe { std::mem::zeroed::<termios2>() };
- unsafe { tcgets2(opts.file.as_raw_fd(), &raw mut t2)? };
- t2.c_ospeed
- };
-
+ let speed = cfgetospeed(termios);
let mut printer = WrappedPrinter::new(window_size);
- // BSDs and Linux use a u32 for the baud rate, so we can simply print it.
- #[cfg(any(target_os = "linux", bsd))]
+ // BSDs use a u32 for the baud rate, so we can simply print it.
+ #[cfg(bsd)]
printer.print(&translate!("stty-output-speed", "speed" => speed));
// Other platforms need to use the baud rate enum, so printing the right value
// becomes slightly more complicated.
- #[cfg(not(any(target_os = "linux", bsd)))]
+ #[cfg(not(bsd))]
for (text, baud_rate) in BAUD_RATES {
if *baud_rate == speed {
printer.print(&translate!("stty-output-speed", "speed" => (*text)));