From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager] ui: pbs: datastore: don't underflow for estimation calculation
Date: Tue, 1 Dec 2026 14:08:41 +0100 [thread overview]
Message-ID: <20261201130846.2469057-1-d.csapak@proxmox.com> (raw)
PBS calculates the 'estimated full' timestamp with a linear regression.
This can be in the past, and depending on the actual values, it can
be a very large negative number. In that case it could happen that the
subtraction here underflowed, resulting in a panic in debug mode and
very wrong values in release mode.
Using saturating_sub here prevents both.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
ui/src/pbs/datastore/overview.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/src/pbs/datastore/overview.rs b/ui/src/pbs/datastore/overview.rs
index 23e68170..c576d918 100644
--- a/ui/src/pbs/datastore/overview.rs
+++ b/ui/src/pbs/datastore/overview.rs
@@ -312,7 +312,7 @@ fn render_estimated_full(store: &PbsDatastoreResource, now: i64) -> String {
let Some(full_date) = store.estimated_full_date else {
return tr!("Not enough data");
};
- let remaining = full_date - now;
+ let remaining = full_date.saturating_sub(now);
if remaining <= 0 {
tr!("Never")
} else {
--
2.47.3
next reply other threads:[~2026-12-01 13:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 13:08 Dominik Csapak [this message]
2026-12-01 14:57 ` applied: [PATCH datacenter-manager] ui: pbs: datastore: don't underflow for estimation calculation Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201130846.2469057-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.