stty: no verification that tcsetattr applied all settings
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Component
stty
Description
POSIX allows tcsetattr to return success while only partially applying requested changes. GNU stty re-reads terminal settings after tcsetattr and compares them to the requested configuration, exiting with an error if they differ. uutils calls tcsetattr and returns success without verification.
The tcsetattr() function shall return successfully if it was able to perform any of the requested actions, even if some of the requested actions could not be performed.
// src/uu/stty/src/stty.rs:425-431
for arg in &valid_args {
match arg {
ArgOptions::Mapping(mapping) => apply_char_mapping(&mut termios, mapping),
ArgOptions::Flags(flag) => apply_setting(&mut termios, flag),
// ...
}
}
tcsetattr(opts.file.as_fd(), set_arg, &termios)?;
// No readback or comparison follows
GNU performs tcgetattr after setting, compares with eq_mode(), and calls error(EXIT_FAILURE, ...) if settings don't match.
Impact
On platforms where tcsetattr applies only a subset of changes, uutils exits successfully while the terminal remains misconfigured. Scripts disabling echo for password input may silently fail, exposing sensitive data.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/uu/stty/src/stty.rs:425-431, where tcsetattr is called after applying valid_args. Read the surrounding termios handling and compare GNU stty's tcgetattr and eq_mode verification described in the issue. Done means stty detects partially applied settings and exits with an error instead of reporting success.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100