[Pkg-utopia-maintainers] Bug#1109970: Bug#1109970: upower crashes due to -NaN battery percentage from ACPI
Michael Biebl
biebl at debian.org
Sun Jul 27 14:17:55 BST 2025
Hi
Am 27.07.25 um 12:13 schrieb Renkas Mykhailo:
> Package: upower
> Version: 1.90.3-1
> Severity: important
> Tags: patch upstream
>
> Dear Maintainer,
>
> On systems with broken battery controllers, ACPI may report an invalid battery
> capacity value, specifically `-NaN`. This causes `upowerd` to crash repeatedly
> due to an invalid gdouble being passed to `g_object_set`.
>
> This leads to system instability or continuous reboots due to repeated crashes
> of systemd-managed services.
>
> The following patch adds a basic sanity check to clamp invalid values to 0.0.
>
> --- PATCH START ---
> --- upower-1.90.3.orig/src/linux/up-device-supply.c
> +++ upower-1.90.3/src/linux/up-device-supply.c
> @@ -313,6 +313,11 @@ up_device_supply_refresh_device (UpDevic
> if (percentage == 100.0)
> state = UP_DEVICE_STATE_FULLY_CHARGED;
>
> + if (!isfinite(percentage) || percentage < 0.0 || percentage > 100.0) {
> + g_warning("Invalid percentage value: %f, setting to 0.0", percentage);
> + percentage = 0.0;
> + }
> +
> g_object_set (device,
> "percentage", percentage,
> "battery-level", level,
It would be great if you can submit a merge request upstream at
https://gitlab.freedesktop.org/upower/upower
We avoid applying patches downstream as much as possible, especially if
the issue is not Debian specific.
Regards,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-utopia-maintainers/attachments/20250727/32029cf3/attachment.sig>
More information about the Pkg-utopia-maintainers
mailing list