From d17d0abff56bfa76f6e6881bcb52dd9ba027d2cc Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Fri, 20 Mar 2015 17:56:36 +0100 Subject: [PATCH] btrbk: bugfix (blocker): btr_fs_info(): return en empty hash if subvolume at $fs_path is empty (bug introduced in: 14e675bacd8b4a1cf5302f9ee410827ec790f8ec) --- ChangeLog | 5 ++++- btrbk | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77ddaa0..7aac0b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,4 +15,7 @@ * btrbk-0.13 - bugfix: allow '@' character for subvolume names (blocker for ubuntu users, since ubuntu prefixes all subvolumes with '@' in its - subvolume layout) + subvolume layout). Fixes issue #3 + +* btrbk-current + - bugfix: correctly handle empty target subvolumes. Fixes issue #4 diff --git a/btrbk b/btrbk index 0f48fe2..cd41133 100755 --- a/btrbk +++ b/btrbk @@ -47,7 +47,7 @@ use Date::Calc qw(Today Delta_Days Day_of_Week); use Getopt::Std; use Data::Dumper; -our $VERSION = "0.13"; +our $VERSION = "0.14-dev"; our $AUTHOR = 'Axel Burri '; our $PROJECT_HOME = ''; @@ -686,6 +686,9 @@ sub _subtree_list # SUBVOL_PATH relative path to $fs_path # FS_PATH absolute path # node href to tree node +# +# returns an empty hash if the subvolume at $fs_path exists, but contains no subvolumes +# returns undef if the subvolume at $fs_path does not exists sub btr_fs_info($;$) { my $fs_path = shift || die; @@ -704,7 +707,7 @@ sub btr_fs_info($;$) $tree_root = $uuid_info{$detail->{uuid}}->{SUBTREE}; unless($tree_root) { DEBUG "No subvolumes found in: $fs_path"; - return undef; + return {}; } }