From 53dcd5c27bc969b1a28cdcf45da4422cc972e55f Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Fri, 18 Sep 2026 12:48:07 +0200 Subject: [PATCH] stty: print the speed on big-endian PowerPC BSDs The baud rate is printed by one of three cfg-gated branches. The first one is for "BSDs and Linux (not ppc/big-endian ppc64)", but its PowerPC exclusion was a second #[cfg] stacked on top of any(target_os = "linux", bsd), so it applied to the BSDs as well. The second branch is Linux-only and the third covers everything that is neither Linux nor a BSD. On FreeBSD/powerpc64 (big-endian) and FreeBSD/powerpc none of the three was compiled in, and stty silently left "speed N baud;" out of its output. The PowerPC special case is only needed on Linux, where those targets get a BaudRate enum instead of a number. On the BSDs the baud rate is a plain u32 on every architecture, which string_to_baud() already relies on with a bare #[cfg(bsd)]. Restrict the architecture exclusion to Linux so that the BSDs always take the u32 path. Fixes test_stty::test_basic and test_stty::test_stty_uses_stdin on FreeBSD/powerpc64. --- src/uu/stty/src/stty.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index dc1019ce1ab..d6e46d90916 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -650,10 +650,13 @@ fn print_terminal_size( // BSDs and Linux (not ppc/big-endian ppc64) use a u32 for the baud rate, so we can simply // print it. - #[cfg(any(target_os = "linux", bsd))] - #[cfg(all( - not(target_arch = "powerpc"), - not(all(target_arch = "powerpc64", target_endian = "big")) + #[cfg(any( + bsd, + all( + target_os = "linux", + not(target_arch = "powerpc"), + not(all(target_arch = "powerpc64", target_endian = "big")) + ) ))] printer.print(&translate!("stty-output-speed", "speed" => speed));