From 7d656540d77b30a7c31922277fcd6247bb95eff4 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Wed, 31 Jul 2019 13:44:26 +0200 Subject: [PATCH] btrbk: fix btr_tree for subvolumes containing special (unsafe) characters Note that any action (e.g. btrfs send -p) on a subvolume with unsafe characters will still fail with: ERROR: Unsafe command [...] (offending string: "/tmp/btrfs_pool/svol with spaces") --- btrbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrbk b/btrbk index 868f365..d62a8a4 100755 --- a/btrbk +++ b/btrbk @@ -2278,7 +2278,7 @@ sub btr_tree($$$$) # "path" always starts with set REL_PATH my $rel_path = $node->{path}; unless($top_level->{is_root}) { - die unless($rel_path =~ s/^$top_level->{path}\///); + die unless($rel_path =~ s/^\Q$top_level->{path}\E\///); } $node->{REL_PATH} = $rel_path; # relative to {TOP_LEVEL}->{path} }