btrbk: support btrfs-progs 4.13.2: adapt parsing of "btrfs subvolume list"

btrfs-progs v4.13.2 changed the output of "btrfs subvolume list", in
order to make the tabular output format look nicer (?!?):

e4c6772f69
pull/204/head
Axel Burri 2017-10-09 23:04:07 +02:00
parent e9a517f161
commit 0799820556
2 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,8 @@ btrbk-current
* MIGRATION
- If you are using raw targets, make sure to run the
"raw_suffix2sidecar" utility in each target directory.
* Support for btrfs-progs v4.13.2: adapt parsing of "btrfs sub list"
output (close #192).
* Add "resume" command, replacement for "-r, --resume-only" command
line option (which is now deprecated).
* Add "snapshot" command (close #150).

5
btrbk
View File

@ -1001,7 +1001,7 @@ sub btrfs_subvolume_list_readonly_flag($)
my %ro;
foreach (split(/\n/, $ret))
{
die("Failed to parse line: \"$_\"") unless(/^ID ([0-9]+) gen [0-9]+ top level [0-9]+ path /);
die("Failed to parse line: \"$_\"") unless(/^ID\s+([0-9]+)\s+gen\s+[0-9]+\s+top level\s+[0-9]+\s+path\s/);
$ro{$1} = 1;
}
DEBUG "Parsed " . scalar(keys %ro) . " readonly subvolumes for filesystem at: $vol->{PRINT}";
@ -1031,7 +1031,8 @@ sub btrfs_subvolume_list($;@)
foreach (split(/\n/, $ret))
{
my %node;
unless(/^ID ([0-9]+) gen ([0-9]+) cgen ([0-9]+) top level ([0-9]+) parent_uuid ([0-9a-z-]+) received_uuid ([0-9a-z-]+) uuid ([0-9a-z-]+) path (.+)$/) {
# NOTE: btrfs-progs >= 4.13.2 pads uuid's with 36 whitespaces
unless(/^ID\s+([0-9]+)\s+gen\s+([0-9]+)\s+cgen\s+([0-9]+)\s+top level\s+([0-9]+)\s+parent_uuid\s+([0-9a-f-]+)\s+received_uuid\s+([0-9a-f-]+)\s+uuid\s+([0-9a-f-]+)\s+path\s+(.+)$/) {
ERROR "Failed to parse subvolume list (unsupported btrfs-progs) for: $vol->{PRINT}";
DEBUG "Offending line: $_";
return undef;