Repository navigation
shred: support character and block devices - #12296
gabrielhnf wants to merge 1 commit into
Conversation
|
GNU testsuite comparison: |
2e2cc85 to
b0f36b7
Compare
Merging this PR will degrade performance by 19.55%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | cp_recursive_deep_tree[(120, 4)] |
562.5 KB | 699.2 KB | -19.55% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing gabrielhnf:fix-shred-enospc-and-unreadable-files (b0f36b7) with main (6a942ba)
Footnotes
-
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. ↩
|
I hit this bug wiping a real disk, found this PR, and verified your approach Reference numbers, measured through
So GNU writes exactly the device length and does not round the last block up, The branch sits on main as of 2026-05-10 and Two things I would add while you are in there:
I have the same approach ported to current main from testing it, so if you have |
c08af2d to
e11bbf6
Compare
|
Thanks for the detailed testing and feedback! I've rebased the PR onto the latest main and added a regression test to ensure FIFOs remain rejected, as you suggested. |
|
This needs another rebase |
e11bbf6 to
6e67b86
Compare
5dfb443 to
0782457
Compare
|
I think we should not use any metadata at |
|
I see your point, and avoiding metadata checks could reduce some overhead. But Maybe I'm missing something, though. |
|
We could |
|
I ran For regular files, GNU opens with So GNU does still rely on metadata, but I agree that our repeated metadata calls could be avoided. |
0782457 to
a5e1611
Compare
a5e1611 to
102f04f
Compare
102f04f to
8fd7cdb
Compare
8fd7cdb to
78a7631
Compare
78a7631 to
1d5a965
Compare
Fixes #12282 and #12283
shredwas rejecting character and block devices with "not a file" error, and doing nothing on them even when they were valid targets.wipe_fileusedpath.is_file()to validate the target, which returnsfalsefor all non-regular files, including devices. Additionally, the pass sequence was skipped entirely whenmetadata.len() == 0, which is always the case for devices.path.is_file()with a check that also accepts character and block devices on Unix--sizeargument was given--exactis enforced automatically for non-regular files since they have no meaningful block alignment