Skip to content

shred: fix random passes* #7822

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

Closed
wants to merge 0 commits into from
Closed

shred: fix random passes* #7822

wants to merge 0 commits into from

Conversation

Qelxiros
Copy link
Contributor

closes #7809

On my system, the number of random passes (as determined by shred -vn$x foo.txt |& grep random | wc -l) is not determined by x/10. While it's true that 25 is the tipping point at which all patterns are used, the pattern is unclear. I'll open a separate issue so I don't dump too much shell output here. For the purpose of this PR, I changed 3 + x/10 to (x/10).max(3) to get closer to GNU behavior.

Copy link

GNU testsuite comparison:

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

Comment on lines 14 to 15
"000000", "ffffff", "555555", "aaaaaa", "249249", "492492", "6db6db", "924924", "b6db6d",
"111111", "222222", "333333", "444444", "555555", "666666", "777777", "888888", "999999",
Copy link
Contributor

@cakebaker cakebaker Apr 23, 2025

Choose a reason for hiding this comment

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

I think 555555 should only appear once. And the pattern db6db6 is missing.

Comment on lines 257 to 258
at.touch(file);
at.append_bytes(file, &[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

A detail, you can simplify it to:

Suggested change
at.touch(file);
at.append_bytes(file, &[0]);
at.write_bytes(file, &[0]);

@Qelxiros
Copy link
Contributor Author

I mismanaged my branches, see #7830

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 use all internal overwrite patterns in 25 passes
2 participants