Skip to content

refactor(cat): use raw io - #12210

Draft
xtqqczze wants to merge 2 commits into
uutils:mainfrom
xtqqczze:dd-stdin-raw
Draft

xtqqczze wants to merge 2 commits into
uutils:mainfrom
xtqqczze:dd-stdin-raw

Conversation

@xtqqczze

@xtqqczze xtqqczze commented May 10, 2026 •

Copy link
Copy Markdown
Collaborator

Introduce safe wrappers for raw stdio backed by ManuallyDrop<File>. The ManuallyDrop prevents the file descriptor from being closed on drop, which could otherwise lead to undefined behavior.

The wrapper only exposes &File, so safe code cannot take ownership and accidentally drop the underlying descriptor.

@github-actions

github-actions Bot commented May 10, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

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

@xtqqczze
xtqqczze force-pushed the dd-stdin-raw branch 3 times, most recently from c2a52d4 to 07699da Compare May 10, 2026 01:47
@xtqqczze

This comment was marked as outdated.

@xtqqczze xtqqczze changed the title dd: refactor stdin handling to use StdinRaw struct dd: refactor stdio handling May 10, 2026
@xtqqczze
xtqqczze force-pushed the dd-stdin-raw branch 8 times, most recently from 2736ee9 to e95946e Compare May 10, 2026 19:36
@xtqqczze xtqqczze changed the title dd: refactor stdio handling feat: refactor stdio handling May 10, 2026
@oech3

This comment was marked as resolved.

@xtqqczze

This comment was marked as resolved.

@codspeed

codspeed Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 28.83%

2 warnings, 1 note

⚠️ 126 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

❌ 1 regressed benchmark
✅ 414 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory timeout_enforced 88.8 KB 124.7 KB -28.83%

Tip

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


Comparing xtqqczze:dd-stdin-raw (d429a87) with main (9ed1dfc)

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. ↩

@xtqqczze
xtqqczze force-pushed the dd-stdin-raw branch 2 times, most recently from 42e5ae2 to a5a2281 Compare May 13, 2026 13:15
@xtqqczze xtqqczze changed the title feat: refactor stdio handling cat: refactor stdio handling May 13, 2026
Comment thread src/uucore/src/lib/mods/stdio.rs Resolved
@xtqqczze
xtqqczze marked this pull request as ready for review May 13, 2026 15:46
@xtqqczze
xtqqczze marked this pull request as draft May 21, 2026 17:49
@xtqqczze
xtqqczze marked this pull request as ready for review May 24, 2026 13:44
@xtqqczze
xtqqczze force-pushed the dd-stdin-raw branch 5 times, most recently from b6d885e to 657641d Compare September 5, 2026 07:47
@xtqqczze

This comment was marked as outdated.

@xtqqczze

This comment was marked as outdated.

@xtqqczze
xtqqczze marked this pull request as draft September 5, 2026 12:59
@xtqqczze
xtqqczze marked this pull request as ready for review September 8, 2026 02:44
@xtqqczze
xtqqczze marked this pull request as draft September 25, 2026 17:37
@xtqqczze xtqqczze changed the title cat: refactor stdio handling refactor(cat): use raw io Sep 25, 2026
@xtqqczze
xtqqczze force-pushed the dd-stdin-raw branch 3 times, most recently from 89ab7f2 to 91f8d37 Compare October 18, 2026 03:34
@xtqqczze
xtqqczze force-pushed the dd-stdin-raw branch 2 times, most recently from 94b87e7 to c748cc0 Compare November 21, 2026 14:52
Introduce safe wrappers for raw stdin, stdout, and stderr backed by
`ManuallyDrop<File>`.

`ManuallyDrop` ensures the underlying standard stream file descriptors
are not closed when the wrappers are dropped. The wrappers only expose
shared or mutable references to the underlying `File`, preventing safe
code from taking ownership and accidentally closing the descriptors.

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.

2 participants