Skip to content

shred: Continues after encountering an error #7947

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
BenWiederhake opened this issue May 17, 2025 · 0 comments · May be fixed by #7950
Open

shred: Continues after encountering an error #7947

BenWiederhake opened this issue May 17, 2025 · 0 comments · May be fixed by #7950

Comments

@BenWiederhake
Copy link
Collaborator

After encountering an error in do_pass, our implementation continues, and tries again to overwrite the file:

$ cargo build && LC_ALL=C fiu-run -x -c "enable_random name=posix/io/rw/write,probability=0.01" cargo run shred -vn3 foo
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/coreutils shred -vn3 foo`
shred: foo: pass 1/3 (random)...
shred: foo: File write pass failed: Invalid input
shred: foo: pass 2/3 (random)...
shred: foo: pass 3/3 (random)...
[$? = 1]

However, the GNU implementation doesn't do that:

$ LC_ALL=C fiu-run -x -c "enable_random name=posix/io/rw/write,probability=0.01" shred -vn3 foo
shred: foo: pass 1/3 (random)...
shred: foo: error writing at offset 917504: Disk quota exceeded
[$? = 1]
$ LC_ALL=C fiu-run -x -c "enable_random name=posix/io/rw/write,probability=0.02" shred -vn3 foo
shred: foo: pass 1/3 (random)...
shred: foo: error writing at offset 131072: Interrupted system call
[$? = 1]
$ LC_ALL=C fiu-run -x -c "enable_random name=posix/io/rw/write,probability=0.02" shred -vn3 foo
shred: foo: pass 1/3 (random)...
shred: foo: pass 2/3 (random)...
shred: foo: error writing at offset 786432: Interrupted system call
[$? = 1]

This seems to be due to the following code in fn wipe_file:

        // Ignore failed writes; just keep trying
        show_if_err!(
            do_pass(&mut file, &pass_type, exact, size)
                .map_err_context(|| format!("{}: File write pass failed", path.maybe_quote()))
        );

So apparently we do that intentionally, for some reason? But we shouldn't?

Ping @forticulous, do you know whether there was a good reason that we should do it like this? (In this case, we should probably document it in extensions.md.) Or maybe it should be changed to a regular error instead? (I'm pinging you because of eb64530)

Found while working on #5711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy