From 62f5bc3ce90fedb396d103caae68dc2f211f1b16 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 27 Sep 2020 14:24:44 +0200 Subject: DB: Fix incorrect subpath handling for path that is a superstring of the previous path Files that share a common substring (e.g. `/home/foo/.ssh/id_rsa` and `/home/foo/.ssh/id_rsa.pub`) could incorrectly trigger an optimization that was only supposed to be triggered if the first path is a directory. The first path would then not be added to the database cache even though it should have been. Signed-off-by: Florian Pritz --- lib/App/BorgRestore/DB.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/App/BorgRestore/DB.pm') diff --git a/lib/App/BorgRestore/DB.pm b/lib/App/BorgRestore/DB.pm index 50f5854..319ce55 100644 --- a/lib/App/BorgRestore/DB.pm +++ b/lib/App/BorgRestore/DB.pm @@ -80,7 +80,14 @@ method _migrate() { my $archive_id = $self->get_archive_id($archive); $self->{dbh}->do("alter table `files` rename column `timestamp-$archive` to `$archive_id`"); } -}, + }, + 3 => sub { + # Drop all cached files due to a bug in + # lib/App/BorgRestore/PathTimeTable/DB.pm that caused certain files + # to be skipped rather than being added to the `files` table. + $self->{dbh}->do('delete from `archives`'); + $self->{dbh}->do('delete from `files`'); + }, }; for my $target_version (sort { $a <=> $b } keys %$schema) { -- cgit v1.2.3-24-g4f1b