From 3afd505f3da88a2da0fac1e5b06367238a7906f2 Mon Sep 17 00:00:00 2001 From: Denis Garsh Date: Thu, 22 Jan 2026 10:05:50 +0300 Subject: [PATCH] Reconcile backup.info with backups on disk --- src/command/verify/verify.c | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/command/verify/verify.c b/src/command/verify/verify.c index a9fc4d210a..565b05da13 100644 --- a/src/command/verify/verify.c +++ b/src/command/verify/verify.c @@ -1910,6 +1910,19 @@ verifyProcess(const bool verboseText) storage, STORAGE_REPO_BACKUP_STR, .expression = backupRegExpStr), sortOrderAsc); + + // Warn if backups on disk are not described in backup.info + for (unsigned int repoIdx = 0; repoIdx < strLstSize(jobData.backupList); repoIdx++) + { + const String *const label = strLstGet(jobData.backupList, repoIdx); + + if (!infoBackupLabelExists(backupInfo, label)) + { + LOG_WARN_FMT( + "backup '%s' is not described in " INFO_BACKUP_FILE, + strZ(label)); + } + } } else jobData.backupList = strLstNew(); @@ -1947,6 +1960,31 @@ verifyProcess(const bool verboseText) jobData.enableArchiveFilter = true; } + // Check if backup.info contains backups not on disk and add them for processing. + if (!backupLabelInvalid && backupLabel == NULL) + { + const StringList *infoBackupLabelList = infoBackupDataLabelList(backupInfo, NULL); + + for (unsigned int infoIdx = 0; infoIdx < strLstSize(infoBackupLabelList); infoIdx++) + { + const String *infoLabel = strLstGet(infoBackupLabelList, infoIdx); + + if (strLstFindIdxP(jobData.backupList, infoLabel) == LIST_NOT_FOUND) + { + LOG_WARN_FMT( + "backup '%s' exists in " INFO_BACKUP_FILE " but was not found on disk", + strZ(infoLabel)); + + MEM_CONTEXT_BEGIN(jobData.memContext) + { + strLstAdd(jobData.backupList, strDup(infoLabel)); + } + MEM_CONTEXT_END(); + } + } + jobData.backupList = strLstSort(jobData.backupList, sortOrderAsc); + } + // Only begin processing if there are some archives or backups in the repo if (!strLstEmpty(jobData.archiveIdList) || !strLstEmpty(jobData.backupList)) {