Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
=== rmw ChangeLog ===

2025-10-20
* (bugfix) Allow rmw to move directories to waste folder on btrfs filesystems

2024-11-07

* Update ChangeLog to note btrfs cloning is supported only on Linux
Expand Down
6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ damage of 5000 hp. You feel satisfied.\n"));
printf(_("%s resides within a waste folder and has been ignored\n"),
argv[file_arg]);
is_protected = 1;
if (getenv("RMW_FAKE_HOME"))
n_err++;
break;
}
waste_curr = waste_curr->next_node;
Expand Down Expand Up @@ -410,7 +412,7 @@ damage of 5000 hp. You feel satisfied.\n"));
int r_result = 0;
if (cli_user_options->want_dry_run == false)
{
if (waste_curr->dev_num != st_target.dev_num)
if ((waste_curr->dev_num != st_target.dev_num) && !S_ISDIR(st_file_arg.st_mode))
{
int save_errno = errno;
r_result =
Expand Down Expand Up @@ -805,7 +807,7 @@ Please check your configuration file and permissions\
st_location,
&cli_user_options);

if (result > 1)
if (result)
{
dispose_waste(st_config_data.st_waste_folder_props_head);
/* Don't need to print any messages here. Any warnings or errors
Expand Down
4 changes: 2 additions & 2 deletions test/test_basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ test "$output" = "6"

echo "$SEPARATOR"
echo " == rmw should refuse to move a waste folder or a file that resides within a waste folder"
output="$($RMW_TEST_CMD_STRING "$PRIMARY_WASTE_DIR"/info)"
output="$($RMW_TEST_CMD_STRING "$PRIMARY_WASTE_DIR"/info || true)"
test "${output}" = " :warning: "$PRIMARY_WASTE_DIR"/info resides within a waste folder and has been ignored
0 items were removed to the waste folder"

# If the file gets removed (which it shouldn't), then the test that follows it will fail
$RMW_TEST_CMD_STRING "$PRIMARY_WASTE_DIR"/info/1.trashinfo
$RMW_TEST_CMD_STRING "$PRIMARY_WASTE_DIR"/info/1.trashinfo || true

echo "\n\n == Display contents of 1.trashinfo "
cat "$PRIMARY_WASTE_DIR"/info/1.trashinfo
Expand Down
16 changes: 15 additions & 1 deletion test/test_btrfs_clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,21 @@ fi

cd "$BTRFS_IMAGE_MOUNTPOINT"
RMW_TEST_CMD_STRING="$BIN_DIR/rmw -c ${MESON_SOURCE_ROOT}/test/conf/btrfs_img.testrc"
WASTE_USED="/tmp/rmw-loop/three/Waste"

SUBVOLUME_USED="/tmp/rmw-loop/three"

WASTE_USED="$SUBVOLUME_USED/Waste"
if [ -d "$WASTE_USED" ]; then
rm -rf "$WASTE_USED"
fi

TEST_DIR="$SUBVOLUME_USED/test_dir"
if [ -d "$TEST_DIR" ]; then
rm -rf "$TEST_DIR"
fi

mkdir "$TEST_DIR"
$RMW_TEST_CMD_STRING -v "$TEST_DIR"

touch foo
$RMW_TEST_CMD_STRING foo
Expand Down
Loading