[Pkg-utopia-maintainers] Bug#1109970: Bug#1109970: upower crashes due to -NaN battery percentage from ACPI
Sicelo
absicsz at gmail.com
Sun Jul 27 18:45:37 BST 2025
Hi
On Sun, Jul 27, 2025 at 03:17:55PM +0200, Michael Biebl wrote:
> >
> > 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
I agree with Michael, and would actually suggest opening an issue
instead of a pull request, so the problem can be investigated properly.
Incidentally, this code should only run for powered peripherals, not the
system power supply. So it should most likely not be triggered by ACPI,
buggy or not. As a result, I do not expect upower folk to merge the
patch as is. While it would seem to be working, it is likely masking a
bigger issue that warrants a proper fix, perhaps even outside upower
itself, e.g. kernel.
Sincerely,
Sicelo
More information about the Pkg-utopia-maintainers
mailing list