Skip to content

restore() fails when quarantine is on another filesystem #42

Description

@Muawiya-contact

quarantine() handles the cross-filesystem case:

if std::fs::rename(file, &dest).is_err() {
    std::fs::copy(file, &dest)...;
    std::fs::remove_file(file)...;
}

restore() does not — it's fs::rename and nothing else.

So the exact case the move handles is the case the undo fails on. The app puts quarantine in the app-local-data dir, so any file scanned from another mount (a second drive, /home on its own partition) hits this: quarantining works, restoring returns EXDEV.

Fix is to pull the rename-then-copy-fallback out into a shared helper and use it in both directions.

crates/diskern-core/src/actions.rs:60

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersrustPull requests that update rust codesafetyTouches the read-only / quarantine guarantees

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions