From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 17C081FF13F for ; Thu, 12 Feb 2026 15:54:33 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 207DD1270D; Thu, 12 Feb 2026 15:55:19 +0100 (CET) Date: Thu, 12 Feb 2026 15:54:40 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= Subject: Re: [PATCH proxmox-backup] fix #7305: client: restore: filter out last snapshot if not finished To: Christian Ebner , pbs-devel@lists.proxmox.com References: <20260211152452.894157-1-c.ebner@proxmox.com> In-Reply-To: <20260211152452.894157-1-c.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1770907549.yrzyvu2z27.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770908081010 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.046 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: SFFSBGIUN5KGTCOO6YZNIE7AX3F3RP2E X-Message-ID-Hash: SFFSBGIUN5KGTCOO6YZNIE7AX3F3RP2E X-MailFrom: f.gruenbichler@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On February 11, 2026 4:24 pm, Christian Ebner wrote: > When invoking the client CLI for restore via: > ``` > proxmox-backup-client restore > ``` > the provide a backup group only, in which case the client > falls back to restore the last snapshot of that group as convenience. >=20 > The snapshot listing used to identify the last snapshot returns > however all snapshots, including unfinished ones, a restore on an > unfinished one will therefore fail. >=20 > Fix this by filtering out snapshots which do not contain a manifest > file yet, and therefore are not considered as finished. Also adapt > the helper function name to reflect this change. Ideally this would > happen on the server side, guarded by some flag, but that will not > work with older server versions. >=20 > Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=3D7305 > Signed-off-by: Christian Ebner > --- > Note: > The behaviour can be easily tested by simply temporarily renaming the > index.json.blob in the last snapshot of a backup group to simulate an > ongoing backup for that snapshot. >=20 > proxmox-backup-client/src/main.rs | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) >=20 > diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/sr= c/main.rs > index 999e50205..7e20b9cc8 100644 > --- a/proxmox-backup-client/src/main.rs > +++ b/proxmox-backup-client/src/main.rs > @@ -160,7 +160,7 @@ async fn api_datastore_list_snapshots( > Ok(result["data"].take()) > } > =20 > -pub async fn api_datastore_latest_snapshot( > +pub async fn api_datastore_latest_finished_snapshot( > client: &HttpClient, > store: &str, > ns: &BackupNamespace, > @@ -175,6 +175,21 @@ pub async fn api_datastore_latest_snapshot( > =20 > list.sort_unstable_by(|a, b| b.backup.time.cmp(&a.backup.time)); > =20 > + // only once a snapshots contains the manifest it is considered fini= shed > + let last_is_finished =3D list[0] > + .files > + .iter() > + .any(|content| content.filename =3D=3D MANIFEST_BLOB_NAME.as_ref= ()); > + > + if !last_is_finished { > + if list.len() > 1 { > + log::info!("last snapshot of group {group} not finished, use= previous instead"); > + return Ok((group, list[1].backup.time).into()); > + } else { > + bail!("backup group {group} does not contain finished snapsh= ots."); > + } > + } couldn't this be a combinator instead? i.e., something like let last_finished_time =3D list .iter() .find_map(|snap| { snap.files.iter().find_map(|content| { if content.filename =3D=3D MANIFEST_BLOB_NAME.as_ref() { Some(snap.backup.time) } else { None } }) }) .ok_or_else(|| { format_err!("backup group {group} does not contain any finished= snapshots.") })?; to account for multiple snapshots with missing manifests? those should not occur "naturally", but might exist cause of accidents/.. > + > Ok((group, list[0].backup.time).into()) > } > =20 > @@ -187,7 +202,7 @@ pub async fn dir_or_last_from_group( > match path.parse::()? { > BackupPart::Dir(dir) =3D> Ok(dir), > BackupPart::Group(group) =3D> { > - api_datastore_latest_snapshot(client, repo.store(), ns, grou= p).await > + api_datastore_latest_finished_snapshot(client, repo.store(),= ns, group).await > } > } > } > --=20 > 2.47.3 >=20 >=20 >=20 >=20 >=20 >=20