coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

Fix stty panic on glibc 2.42 (hotfix)

Open naoNao89 opened this issue 1 month ago • 15 comments

Catches panics from cfgetospeed() on glibc 2.42. Removes .expect() and .unwrap() calls in termios handling. Suppresses panic messages.

stty now gracefully skips speed display instead of crashing.

Temporary workaround pending upstream nix fix.

Fixes #8474

before 
podman run -it --rm -v /coreutils:/workspace ubuntu:25.10 bash -c "cd /workspace && ./target/debug/stty 2>&1"
time="2025-11-25T10:05:03+07:00" level=warning msg="The input device is not a TTY. The --tty and --interactive flags might not work properly"

thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nix-0.30.1/src/sys/termios.rs:767:70:
called `Result::unwrap()` on an `Err` value: EINVAL
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
line = 0;
-brkint ixon -imaxbel
---
After
podman run --rm -v /coreutils:/workspace ubuntu:25.10 bash -c "
cd /workspace
apt-get update -qq >/dev/null 2>&1
apt-get install -y cargo >/dev/null 2>&1
rm -f target/debug/stty target/debug/deps/uu_stty-*
cargo build -p uu_stty 2>&1 | tail -2
echo 'TESTING:'
./target/debug/stty 2>&1 | head -3
" 2>&1
  Downloaded libc v0.2.175
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.19s
TESTING:
stty: Inappropriate ioctl for device

naoNao89 avatar Nov 25 '25 08:11 naoNao89

i think you committed way too many files

sylvestre avatar Nov 25 '25 08:11 sylvestre

@ChrisDryden Is this not conflicting with any your PRs?

oech3 avatar Nov 25 '25 08:11 oech3

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Nov 25 '25 09:11 github-actions[bot]

😴

naoNao89 avatar Nov 25 '25 09:11 naoNao89

i forgot to unstage the docs generated when researching on the internet

naoNao89 avatar Nov 25 '25 09:11 naoNao89

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar Nov 25 '25 09:11 github-actions[bot]

I patched your PR to main at Arch Linux. But fish: Job 1, ''/tmp/makepkg/uutils-coreutils-…' terminated by signal SIGABRT (Abort).

oech3 avatar Nov 25 '25 10:11 oech3

https://github.com/uutils/coreutils/pull/9483#issuecomment-3574827444

This project has release-{fast,small} with panic=abort.

oech3 avatar Nov 25 '25 10:11 oech3

@ChrisDryden Is this not conflicting with any your PRs?

This doesn't appear to conflict with any of the open PR's should be good to go.

ChrisDryden avatar Nov 25 '25 18:11 ChrisDryden

i should contribute to nix instead fix the underlying API so cfgetospeed() returns Result rather than panicking. that's the real solution instead of catching panics globally. this workaround doesn't help with panic=abort anyway.

naoNao89 avatar Nov 26 '25 01:11 naoNao89

https://github.com/uutils/coreutils/pull/9483#issuecomment-3576973842 Thankyou.

oech3 avatar Nov 26 '25 01:11 oech3

https://github.com/uutils/coreutils/pull/9483#issuecomment-3578363347 nix rust-libc people are hesitating to use both of raw ioctl and versioned symbol of glibc BTW...

oech3 avatar Nov 26 '25 01:11 oech3

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Nov 26 '25 09:11 github-actions[bot]

@naoNao89 https://github.com/nix-rust/nix/issues/2672#issuecomment-3601704006 with help of nix?

oech3 avatar Dec 02 '25 12:12 oech3

@oech3 Sorry for being AFK for a few days, i have been busy with some heists. See you in the next 16 hours :))

naoNao89 avatar Dec 03 '25 11:12 naoNao89