pgbackrest.git / summary / log / commit / refs

commit    26c568b7bcd58934a44f93a55a8ef28e5259ef17
Author:   David Steele <david@pgmasters.net>
Date:     Tue Jan 20 21:20:27 2015 +0000

    Manifest checksum failure shows expected value to allow manual fix - though not recommended.


README.md | 2 ++ lib/BackRest/Manifest.pm | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5418efb2d..351334adc 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ Primary PgBackRest features: * Link (called latest) always points to the last backup. This has been added for convenience and to make restore simpler. +* Checksum for backup.manifest to detect corrupted/modified manifest. + ### v0.30: core restructuring and unit tests * Complete rewrite of BackRest::File module to use a custom protocol for remote operations and Perl native GZIP and SHA operations. Compression is performed in threads rather than forked processes. diff --git a/lib/BackRest/Manifest.pm b/lib/BackRest/Manifest.pm index a49efefd0..9a4178f42 100644 --- a/lib/BackRest/Manifest.pm +++ b/lib/BackRest/Manifest.pm @@ -87,10 +87,11 @@ sub new # Make sure the manifest is valid by testing checksum my $strChecksum = $self->get(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_CHECKSUM); + my $strTestChecksum = $self->hash(); - if ($strChecksum ne $self->hash()) + if ($strChecksum ne $strTestChecksum) { - confess &log(ERROR, 'backup.manifest checksum is invalid'); + confess &log(ERROR, "backup.manifest checksum is invalid, should be ${strTestChecksum}"); } } [parent: 92c9ed8963b9]