+
Skip to content

Conversation

julian-klode
Copy link
Contributor

The expect() calls cause stty to panic if we are not attached to a tty with ENOTTY. This in turn causes shells to print messages "Aborted (core dumped)", breaking tests that assume empty stderr [with normal stderr of the process being redirected].

Refactor the code to use .and_then() and .map_err() to map the resulting nix Errno into a boxed UIoError.

@julian-klode
Copy link
Contributor Author

julian-klode commented Sep 5, 2025

Expected:

jak@jak-t14-g3 ~/P/U/rust-coreutils-0.1.0+git20250813.4af2a84 (ubuntu/devel) [1]> gnustty -F /dev/stdin  < README.md
gnustty: /dev/stdin: Inappropriate ioctl for device

Before:

jak@jak-t14-g3 ~/P/U/rust-coreutils-0.1.0+git20250813.4af2a84 (ubuntu/devel)> ./target/release/coreutils stty -F /dev/stdin  < README.md

thread 'main' panicked at src/uu/stty/src/stty.rs:427:52:
Could not get terminal attributes: ENOTTY
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fish: Job 1, './target/release/coreutils stty…' terminated by signal SIGABRT (Abort)

After:

jak@jak-t14-g3 ~/P/U/rust-coreutils-0.1.0+git20250813.4af2a84 (ubuntu/devel) [SIGABRT]> ./target/debug/coreutils stty -F /dev/stdin  < README.md
stty: Inappropriate ioctl for device

Missing the filename, but haven't stored it anywhere.

@julian-klode
Copy link
Contributor Author

Prettyfied a bit by using "?" and a terminal Ok(())

The expect() calls cause stty to panic if we are not attached to
a tty with ENOTTY. This in turn causes shells to print messages
"Aborted (core dumped)", breaking tests that assume empty stderr
[with normal stderr of the process being redirected].

Simply replace .expect() with ? to handle this.
Copy link

github-actions bot commented Sep 5, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit ec9fcb5 into uutils:main Sep 6, 2025
93 checks passed
@cakebaker
Copy link
Contributor

Thanks!

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.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载