Skip to content

shred: handle '-' as stdout#12300

Open
gabrielhnf wants to merge 1 commit into
uutils:mainfrom
gabrielhnf:fix-shred-stdout-dash
Open

shred: handle '-' as stdout#12300
gabrielhnf wants to merge 1 commit into
uutils:mainfrom
gabrielhnf:fix-shred-stdout-dash

Conversation

@gabrielhnf
Copy link
Copy Markdown

Fixes #12288

Resolve - to /dev/fd/1 on Unix systems, allowing shred to operate on whatever stdout is connected to. This matches the UNIX convention used by most coreutils tools.

When stdout is a pipe or terminal, the existing file type validation naturally rejects it with "not a file".
This doesn't match GNU's "invalid file type", but feels out of scope for the issue.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 15, 2026

Merging this PR will improve performance by 13.72%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 315 untouched benchmarks
⏩ 46 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory cp_recursive_deep_tree[(120, 4)] 699.2 KB 562.5 KB +24.31%
Simulation ls_recursive_balanced_tree[(6, 4, 15)] 50.9 ms 48.9 ms +4.03%

Tip

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


Comparing gabrielhnf:fix-shred-stdout-dash (bbb9c48) with main (d09f351)

Open in CodSpeed

Footnotes

  1. 46 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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/retry (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.
Congrats! The gnu test tests/pr/bounded-memory is now passing!

Comment thread src/uu/shred/src/shred.rs Outdated
@@ -627,7 +627,16 @@ fn wipe_file(
force: bool,
) -> UResult<()> {
// Get these potential errors out of the way first
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this comment should move down, or be removed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure!

@gabrielhnf gabrielhnf force-pushed the fix-shred-stdout-dash branch from fb75c78 to bbb9c48 Compare May 15, 2026 13:22
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.

shred should treat - as standard output

2 participants