diff --git a/ChangeLog b/ChangeLog index 339ca26..61a8b08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ btrbk-current * Add "raw_target_block_size" configuration option (close #105). * Add "backend" configuration option (experimental). * Bugfix: fix "list latest" with no snapshots (close #111). + * Support for btrfs-progs v4.8.3: fix parsing of "btrfs sub show" + output, which has changed for toplevel subvolume. btrbk-0.23.3 diff --git a/btrbk b/btrbk index 0c32c92..16c89a7 100755 --- a/btrbk +++ b/btrbk @@ -828,14 +828,13 @@ sub btrfs_subvolume_show($) $real_path = $path; WARN "No real path provided by \"btrfs subvolume show\" for subvolume \"$vol->{PRINT}\", using: $path"; } - my %detail = ( REAL_PATH => $real_path ); + my %detail; if($ret =~ /^\Q$real_path\E is (btrfs root|toplevel subvolume)/) { # btrfs-progs < 4.4 prints: " is btrfs root" # btrfs-progs >= 4.4 prints: " is toplevel subvolume" - DEBUG "found btrfs root: $vol->{PRINT}"; - $detail{id} = 5; - $detail{is_root} = 1; + # btrfs-progs >= 4.8.3 does not enter here, as output shares format with regular subvolumes + $detail{id} = 5; } elsif($ret =~ /^\Q$real_path\E/) { TRACE "btr_detail: found btrfs subvolume: $vol->{PRINT}"; @@ -887,6 +886,17 @@ sub btrfs_subvolume_show($) ERROR "Failed to parse subvolume detail (unsupported btrfs-progs) for: $vol->{PRINT}"; return undef; } + + if($detail{id} == 5) { + # NOTE: as of btrfs-progs v4.8.3, we get full output for root + # subvolume, with lots of '0' and '-' (especially uuid='-'). + # This breaks things, set $detail to sane values: + DEBUG "found btrfs root: $vol->{PRINT}"; + %detail = ( id => 5, is_root => 1 ); + } + + $detail{REAL_PATH} = $real_path; + return \%detail; }