uu shred has a different probability distribution of overwrites from GNU shred
Open
Nobody has claimed this yet.
good first issue
reported-canonical-2
U - shred
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
uu shred implements both algorithms, and the following test demonstrates that, for 1000 passes, uu shred's default algorithm has 246 multibyte overwrites, in contrast to 318 for GNU's.
#[test]
fn test_pattern_multicount() {
use std::{cell::RefCell, fs::OpenOptions, io::Write};
let mut f = OpenOptions::new().read(true).write(true).create(true).truncate(true).open("/tmp/uu_shred_test_pattern").unwrap();
// create_test_compatible_sequence requires that the random source consist of only 0x55's
f.write(&[0x55; 1024]).unwrap();
f.flush().unwrap();
let rng = Some(RefCell::new(f));
let n = 1000;
let a = crate::create_test_compatible_sequence(n, rng.as_ref()).unwrap();
let b = crate::create_standard_pass_sequence(n).unwrap();
use crate::{PassType,Pattern};
println!("a {:?}", a.iter().filter(|x| matches!(x, PassType::Pattern(Pattern::Multi(_)))).count());
println!("b {:?}", b.iter().filter(|x| matches!(x, PassType::Pattern(Pattern::Multi(_)))).count());
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided test and the implementations of create_test_compatible_sequence and create_standard_pass_sequence. Compare their pass-selection behavior with GNU shred for 1000 passes, using the multibyte overwrite counts as the check. Done means uu shred's default algorithm produces the same probability distribution as GNU shred.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100