-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
stty: Improve option handling and align behavior with GNU coreutils #9255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mattsu2020
wants to merge
14
commits into
uutils:main
Choose a base branch
from
mattsu2020:stty_fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add GNU-compatible parsing of colon-separated hex -g output - Restore termios from saved state before applying new settings - Preserve platform-dependent fields while validating input robustly
- Replace Box<dyn UError> with USimpleError for stty helpers and save-format parsing to reduce indirection and simplify error handling - Use as_str/copied for argument iteration and convert flag bits via into() for clearer, more idiomatic Rust and improved type safety
- Update missing/invalid argument helpers to return Box<dyn UError> for consistent error typing - Propagate errors with map_err(Into::into) at call sites to match new helper signatures - Simplify string handling (String::as_str, &**s) to reduce verbosity and clarify intent
- Return USimpleError directly from missing_arg/invalid_* helpers to avoid Box indirection - Replace redundant map_err(Into::into) uses with direct missing_arg calls for clarity - Aligns error handling with UResult expectations and improves readability
- Fix mis-indented else branch to ensure missing_arg is called correctly - Improve readability and maintain consistent control flow structure
- Cast parsed hex flag values to u64 to match bitflag expectations - Remove redundant conversions when constructing termios flag sets - Ensures proper handling of saved formats on platforms with 64-bit flags
- Use parse_hex_u32 return type directly for flag bitfields - Simplifies code by eliminating unnecessary u32-to-u64 conversions
- Cast parsed flag bit values into appropriate integer types - Prevent potential type mismatch or incorrect flag interpretation during restore
- Use tcflag_t-based parser for hex flag values to match termios types - Avoid extra casts when reconstructing Input/Output/Control/Local flags for correctness and clarity
- Add tcflag, bitflag, and lflags to spell-checker ignore list - Prevent false positives when working with recently added flag names
- Add "cflags" to spell-checker ignore hints in stty.rs - Prevent false positives during spell-checking for terminal flag names
- Treat unknown dash-prefixed arguments as invalid options to match GNU stty behavior - Treat unrecognized bare words as missing arguments for clearer error reporting
- Treat unrecognized options starting with '-' as invalid arguments - Treat unrecognized bare words as invalid arguments instead of missing - Match project test expectations and clarify the inline documentation
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging #9255 will degrade performances by 2.22%Comparing Summary
Benchmarks breakdown
Footnotes
|
|
GNU testsuite comparison: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Details:
Rationale:
Scope / Impact:
Testing:
#9056