File: shred-revert-rand.diff

package info (click to toggle)
rust-coreutils 0.0.30-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,388 kB
  • sloc: sh: 1,088; python: 407; javascript: 72; makefile: 51
file content (28 lines) | stat: -rw-r--r-- 1,149 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
commit ddb027231f66591dd677926ef3117a912bec1d24
Author: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Date:   Wed Jan 29 14:59:47 2025 +0100

    shred: adapt to API changes of rand

diff --git b/src/uu/shred/src/shred.rs a/src/uu/shred/src/shred.rs
index 9107bcde5..763d6cfd4 100644
--- b/src/uu/shred/src/shred.rs
+++ a/src/uu/shred/src/shred.rs
@@ -176,7 +176,7 @@ impl BytesWriter {
     fn from_pass_type(pass: &PassType) -> Self {
         match pass {
             PassType::Random => Self::Random {
-                rng: StdRng::from_os_rng(),
+                rng: StdRng::from_entropy(),
                 buffer: [0; BLOCK_SIZE],
             },
             PassType::Pattern(pattern) => {
@@ -452,7 +452,7 @@ fn wipe_file(
             for pattern in PATTERNS.into_iter().take(remainder) {
                 pass_sequence.push(PassType::Pattern(pattern));
             }
-            let mut rng = rand::rng();
+            let mut rng = rand::thread_rng();
             pass_sequence.shuffle(&mut rng); // randomize the order of application
 
             let n_random = 3 + n_passes / 10; // Minimum 3 random passes; ratio of 10 after