From: Efe Çiftci Date: Fri, 16 May 2025 17:50:21 +0000 (+0300) Subject: [PATCH] Fix incorrect usage percentage in Properties dialog for virtual filesystems X-Git-Tag: archive/raspbian/6.13.0-6+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d26577ca1de0d00cde39dd6a81f2e0d7da4cc9e0;p=kf6-kio.git [PATCH] Fix incorrect usage percentage in Properties dialog for virtual filesystems The Properties dialog for filesystems such as `/proc/` or `/sys/` shows an incorrect usage percentage (i.e., "-2,147,483,648% used"). This commit fixes that issue by avoiding a divbyzero: if the `size` variable is `0`, the `percentUsed` variable is set to `0`. Gbp-Pq: Name upstream_81ca0e2c_Fix-incorrect-usage-percentage-in-Properties-dialog-for-virtual-filesystems.patch --- diff --git a/src/widgets/kpropertiesdialogbuiltin_p.cpp b/src/widgets/kpropertiesdialogbuiltin_p.cpp index 25e146d..910ab16 100644 --- a/src/widgets/kpropertiesdialogbuiltin_p.cpp +++ b/src/widgets/kpropertiesdialogbuiltin_p.cpp @@ -664,7 +664,7 @@ void KFilePropsPlugin::slotFreeSpaceResult(KJob *_job) const qint64 size = job->size(); const qint64 available = job->availableSize(); const quint64 used = size - available; - const int percentUsed = qRound(100.0 * qreal(used) / qreal(size)); + const int percentUsed = (size == 0) ? 0 : qRound(100.0 * qreal(used) / qreal(size)); d->m_ui->capacityBar->setText(i18nc("Available space out of total partition size (percent used)", "%1 free of %2 (%3% used)",