Skip to content

shred: use 4K block #7886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexs-sh
Copy link
Contributor

@alexs-sh alexs-sh commented May 5, 2025

About

Issue #7870

This commit changes the default block size for the shred utility to make it more consistent with the GNU coreutils version.

Before

echo a > foo && cargo run -q --features shred shred -v -n1 foo && du -b foo
shred: foo: pass 1/1 (random)...
65536	foo

After

echo a > foo && cargo run -q --features shred shred -v -n1 foo && du -b foo
shred: foo: pass 1/1 (random)...
4096	foo

Expected

echo a > foo && shred -v -n1 foo && du -b foo
shred: foo: pass 1/1 (random)...
4096	foo

Please note: The shred utility from GNU coreutils uses fstat along with the STP_BLKSIZE macro to determine the block size. Therefore, the block size is not constant and may vary across platforms. The most common sizes are 512 bytes and 4 KB. Here, I started by changing the constant and collecting test results and observations. However, to replicate the behavior of shred, deeper modifications are required. Please feel free to share your thoughts and opinions on which approach is preferable: simply changing the constant or moving block size detection to runtime.

Thank you

This commit changes the default block size for the shred utility to make
it more consistent with the GNU coreutils version.

Issue uutils#7870
Copy link

github-actions bot commented May 5, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

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.

1 participant