diff options
author | Florian Pritz <bluewind@xinu.at> | 2020-09-27 14:24:44 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2020-09-27 14:52:23 +0200 |
commit | 62f5bc3ce90fedb396d103caae68dc2f211f1b16 (patch) | |
tree | db81e08790295762ebfcf7559fa5b3e839ab30d7 /lib/App/BorgRestore/DB.pm | |
parent | f842d625980ca3a946c17c4b3c2846186496c1d2 (diff) | |
download | App-BorgRestore-62f5bc3ce90fedb396d103caae68dc2f211f1b16.tar.gz App-BorgRestore-62f5bc3ce90fedb396d103caae68dc2f211f1b16.tar.xz |
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 <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore/DB.pm')
-rw-r--r-- | lib/App/BorgRestore/DB.pm | 9 |
1 files changed, 8 insertions, 1 deletions
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) { |