Skip to content

stty: support any baud on Linux, replace nix with rustix - #15299

Open
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:stty-unsafe
Open

oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:stty-unsafe

Conversation

@oech3

@oech3 oech3 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

@codspeed

codspeed Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ 119 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 1 benchmark has no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 398 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation factor_thirteen_39_bit_primes 8.7 s 9.5 s -9.02%
⚡ Simulation factor_three_39_bit_primes 800.7 ms 494.1 ms +62.06%
⚡ Simulation factor_five_38_bit_primes 1.8 s 1.6 s +13.27%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing oech3:stty-unsafe (36d4d16) with main (2fb77e8)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment thread src/uu/stty/Cargo.toml Outdated
Comment thread src/uu/stty/src/stty.rs Outdated
Comment thread src/uu/stty/src/stty.rs Outdated
Comment thread src/uu/stty/src/stty.rs Outdated
@oech3
oech3 marked this pull request as draft October 13, 2026 16:36
Comment thread src/uu/stty/src/stty.rs Outdated
@oech3
oech3 force-pushed the stty-unsafe branch 5 times, most recently from 8c0b529 to 39bc936 Compare October 13, 2026 17:09
@oech3 oech3 changed the title stty: remove unsafe & cfg stty: replace nix with rustix Oct 13, 2026
@oech3 oech3 changed the title stty: replace nix with rustix stty: support any baud on Linux, replace nix with rustix Oct 13, 2026
@oech3
oech3 force-pushed the stty-unsafe branch 2 times, most recently from ff11e70 to f100d7d Compare October 13, 2026 17:47
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Note: The gnu test tests/stty/bad-speed is now being skipped but was previously passing.

@oech3
oech3 force-pushed the stty-unsafe branch 2 times, most recently from 9be3124 to d420658 Compare October 13, 2026 18:30
@oech3

This comment was marked as outdated.

@xtqqczze

Copy link
Copy Markdown
Collaborator

Would it be possible to separate the refactor replacing nix with rustix from the fix for #8719 into separate PRs?

@oech3

oech3 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

It is very difficult since rustix automatically supports any baud and nix and rustix cannot be mixed.

@oech3

This comment was marked as resolved.

@oech3

This comment was marked as outdated.

Comment thread src/uu/stty/src/stty.rs Outdated
Comment thread src/uu/stty/src/stty.rs
Comment thread src/uu/stty/src/stty.rs Outdated
Comment thread util/build-gnu.sh
@oech3
oech3 force-pushed the stty-unsafe branch 16 times, most recently from a561bf5 to 0ad3f39 Compare October 15, 2026 04:41
@oech3
oech3 requested a review from sylvestre October 15, 2026 05:42
Comment thread src/uu/stty/src/flags.rs Outdated
Comment thread src/uu/stty/src/flags.rs Outdated
Comment thread src/uu/stty/src/flags.rs Outdated
Flag::new("iutf8", I::IUTF8),
];

// rustix sometimes not export for macos and musl. use libc as workaround...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you add a workaround for a rustix issue, make sure to open an issue at https://github.com/bytecodealliance/rustix and link it in the comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually OLCUC doesn't exist on Apple targets, it was nix mistake...

$ rustc --print host-tuple
aarch64-apple-darwin
$ gstty olcuc  
gstty: invalid argument ‘olcuc’

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But libc crate has. If it is functional, we could have an extension.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ uu-stty --version
stty (uutils coreutils) 0.12.0
$ uu-stty olcuc          
uu-stty: invalid argument 'olcuc'

@oech3 oech3 Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't lost anything if we removed apple (at here or different PR). OK?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't lost anything if we removed apple (at here or different PR). OK?

Apparently not:

$ git rev-parse HEAD                     
2fb77e8b927b5614438d288b0c72827a87106663
uutils-coreutils % cargo run -q --features unix stty olcuc
stty: invalid argument 'olcuc'

@xtqqczze xtqqczze Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion, but there is no issue with the PR, I also see the correct stty: invalid argument 'olcuc' error with oech3:stty-unsafe checked out. (when rebased onto #15360)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is odd that stty is buildable in any cases.

@oech3
oech3 force-pushed the stty-unsafe branch 2 times, most recently from 2ac5fc0 to 36d4d16 Compare October 15, 2026 10:08
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

This branch has not been deployed

No deployments
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.

stty: support B460800 and B921600 baud rates stty: support arbitrary baudrate (at least on linux) as GNU coreutils 9.8

3 participants