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

Merging this PR will improve performance by 30.08%

⚡ 2 improved benchmarks
✅ 387 untouched benchmarks
⏩ 54 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ Simulation three_39_bit_primes 467.5 ms 287.9 ms +62.38%
⚡ Simulation five_38_bit_primes 1.8 s 1.8 s +4.21%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing xtqqczze:dd-stdin-raw (dd8a17a) with main (a6d1eb3)

Open in CodSpeed

Footnotes

  1. 54 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 Outdated
@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
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