Skip to content

rmw won't move directories across btrfs subvolumes on NixOS #509

@durable-vest

Description

@durable-vest

Similar issue to #497, but run on a NixOS system.

Steps to Reproduce

  1. Create a btrfs subvolume to be used as the waste basket
  2. Configure rmw to use the subvolume as a waste basket
  3. Try to remove any directory with rmw

Expected Behavior

The directory is moved to the wastebasket with all contained files.

Actual Outcome

No output to stderr nor stdout, but rmw exits with error code 1. The directory is still intact and the waste directory appears unchanged.

Additional Information

My guess is that the issue comes from safe_mv_via_exec, in particular the use of /bin/mv:

rmw/src/utils.c

Lines 518 to 525 in 6e7fcac

if (pid == 0)
{
/* child: exec /bin/mv directly (argv[0] is "mv") */
char *const argv_mv[] = { "mv", (char *) src, (char *) dst, NULL };
execv("/bin/mv", argv_mv);
/* if execv fails, set errno and exit with a distinct code */
_exit(127);
}

Since NixOS doesn't follow the Filesystem Hierarchy Standard, /bin/mv doesn't exist on my system:

$ ls -l /bin/mv
ls: cannot access '/bin/mv': No such file or directory

$ type mv
mv is /run/current-system/sw/bin/mv

$ echo "$PATH"
/run/wrappers/bin:/home/nixos/.nix-profile/bin:/nix/profile/bin:/home/nixos/.local/state/nix/profile/bin:/etc/profiles/per-user/nixos/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin

Tested on a NixOS virtual machine. Using rmw version 0.9.4, installed via nix profile add github:NixOS/nixpkgs/pull/319544/head#rmw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions