Skip to content

rmw won't move files across bind mounts (even if they share the same underlying filesystem) #508

@durable-vest

Description

@durable-vest

If the file to be trashed (some_file) is on a bindmount and the trash folder (trash_folder) isn't, then rmwrc will fail even if some_file and trash_folder share the same underlying filesystem.
The use case for such a setup is on a NixOS system running impermanence, not sure if this is something that's supported.

One idea to work around this is to add a --move-across-filesystems flag that falls back to mv when the files are across filesystems (i.e. cp some_file trash_folder && rm some_file).

Reproduction steps

Tested on Arch Linux using an ext4 filesystem mounted to /mnt, rmw built from source at 6a78b31

# create bindmounted folder and file
mkdir folder_original
mount --mkdir --bind folder_original folder_bindmounted
touch folder_bindmounted/some_file

# attempt to trash some_file
echo "WASTE = $PWD/trash_folder" > rmwrc
rmw --conf rmwrc folder_bindmounted/some_file

Expected Behavior

The file moves across bind mounts

Actual Behavior

  :error: folder_bindmounted/some_file -> /mnt/trash_folder/files/some_file
rename: Invalid cross-device link

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions