Skip to content

stty: fix: reject "+hex" in parse_saved_state#9662

Open
Rudxain wants to merge 2 commits intouutils:mainfrom
Rudxain:stty-fix-hex
Open

stty: fix: reject "+hex" in parse_saved_state#9662
Rudxain wants to merge 2 commits intouutils:mainfrom
Rudxain:stty-fix-hex

Conversation

@Rudxain
Copy link
Copy Markdown

@Rudxain Rudxain commented Dec 15, 2025

Fixes this pitfall: rust-lang/rust-clippy#16213

Related: #9255

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

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

@sylvestre
Copy link
Copy Markdown
Contributor

@Rudxain still draft after 2 weeks, are you going to work on it? thanks

@Rudxain
Copy link
Copy Markdown
Author

Rudxain commented Dec 27, 2025

are you going to work on it? thanks

Yes! This PR can be merged as-is, but I want to replace from_str_radix by some internal utility. I could simply write an ad-hoc hex-parser, but I assume there's already one, so it's better to reuse the code. The closest I could find was this:

/// Return the digit value of a character in the given base
fn digit(&self, c: char) -> Option<u64> {
fn from_decimal(c: char) -> u64 {
u64::from(c) - u64::from('0')
}
match self {
Self::Binary => ('0'..='1').contains(&c).then(|| from_decimal(c)),
Self::Octal => ('0'..='7').contains(&c).then(|| from_decimal(c)),
Self::Decimal => c.is_ascii_digit().then(|| from_decimal(c)),
Self::Hexadecimal => match c.to_ascii_lowercase() {
'0'..='9' => Some(from_decimal(c)),
c @ 'a'..='f' => Some(u64::from(c) - u64::from('a') + 10),
_ => None,
},
}
}

Should I use that? Or is there something more appropriate?

@Rudxain Rudxain force-pushed the stty-fix-hex branch 3 times, most recently from 641efd8 to 4e269cf Compare December 29, 2025 20:32
@Rudxain
Copy link
Copy Markdown
Author

Rudxain commented Dec 29, 2025

I didn't expect the workflow queue to be cancelled 😕

@sylvestre
Copy link
Copy Markdown
Contributor

Restarted

@Rudxain

This comment was marked as resolved.

@Rudxain Rudxain marked this pull request as ready for review February 3, 2026 20:02
@Rudxain
Copy link
Copy Markdown
Author

Rudxain commented Feb 3, 2026

BTW, this branch is soft-blocked on this PR. Should I include that patch into this PR, or should I keep it separate for better scoping?

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 4, 2026

GNU testsuite comparison:

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

@sylvestre
Copy link
Copy Markdown
Contributor

Could you please add a test to make sure we don't regress in the future? Thanks

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cp/link-heap is now passing!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cp/link-heap is now being skipped but was previously passing.
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@Rudxain
Copy link
Copy Markdown
Author

Rudxain commented Apr 25, 2026

@sylvestre It's finally ready! I've fixed the tests I added

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