From f0dd3fd59afac321317d3b52a36d179b4ea504f7 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 27 Sep 2020 15:49:17 +0200 Subject: DB: Fix incorrect subpath handling for path that is a superstring of the previous path for top level paths Same issue as 62f5bc3ce90fedb396d103caae68dc2f211f1b16 except that this time it is the for top level paths (`/lib` and `/lib64`) which are handled outside the loop. Signed-off-by: Florian Pritz --- lib/App/BorgRestore/PathTimeTable/DB.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/App') diff --git a/lib/App/BorgRestore/PathTimeTable/DB.pm b/lib/App/BorgRestore/PathTimeTable/DB.pm index f92d24c..069d991 100644 --- a/lib/App/BorgRestore/PathTimeTable/DB.pm +++ b/lib/App/BorgRestore/PathTimeTable/DB.pm @@ -100,9 +100,10 @@ method add_path($path, $time) { } $log->tracef("Cache invalidation complete") if TRACE; - if ($old_cache_path ne substr($path, 0, length($old_cache_path))) { + my $cache_check_path = $old_cache_path.'/'; + if ($cache_check_path ne substr($path, 0, length($cache_check_path))) { # ensure that top level directory is also written - $self->_add_path_to_db($self->{archive_id}, $old_cache_path, $self->{cache}->{$old_cache_path}) unless $old_cache_path eq "."; + $self->_add_path_to_db($self->{archive_id}, $old_cache_path, $self->{cache}->{$old_cache_path}) unless ($old_cache_path eq "." or $old_cache_path eq ''); } my $cached = $self->{cache}->{$path}; -- cgit v1.2.3-24-g4f1b