[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#844194: InfoPane.qml:54:22: Unable to assign [undefined] to int



¡Hola Helge!

El 2016-11-16 a las 20:39 +0100, Helge Kreutzmann escribió:
Hello Maximiliano, On Wed, Nov 16, 2016 at 10:25:38AM +0100, Maximiliano Curia wrote:
El 2016-11-15 a las 19:41 +0100, Helge Kreutzmann escribió:
Since Sep. 21 I repeatedly see the following error (?) message in my logs:
Sep 21 21:42:48 samd sddm-greeter[17492]:
file:///usr/share/sddm/themes/breeze/components/InfoPane.qml:54:22:
Unable to assign [undefined] to int Everything (except the PID and the date) is always the same.

That file (/usr/share/sddm/themes/breeze/components/InfoPane.qml) is not included in our packages, where did it come from?

I never manipulate anything within /usr directly, only via apt/dpkg.

Ah, ok, it was present in the 5.7.4 version. The report was made listing sddm-theme-breeze 5.8.2 hence the confusion.

Anyway, the message is still present if you restart sddm (remember to close your graphical session before doing this)?

Ok, I'm still processing my logs, so yes, you are right, this particular message is no longer present since October 13th. However, this file is still present -- if it is no longer packaged, should'nd it be removed? (Maybe a bug in dpkg?)

I wouldn't bet on a dpkg error (ocaml's razor and trying not to break the sharks free [1] :) ).

Could you provide the output of a "ls -l" of /usr/share/sddm/themes/breeze/components/ ?

Would it be possible that the file was restored from a backup? Are you using a special filesystem? Has your system crashed while installing packages? Do you have fsyncs disabled in any way?

Nov 14 22:28:23 samd sddm-greeter[3210]: file:///usr/share/sddm/themes/breeze/components/Battery.qml:39:18: Unable to assign [undefined] to int

And this file is clearly in the current package:
sddm-theme-breeze: /usr/share/sddm/themes/breeze/components/Battery.qml

This message is present since October 13th.

Ok, is there any battery in the system? (I guess not). I'm attaching a patch for the Battery.qml file that takes into account undefined values. Can you test this?

To apply the patch you'll need to run as root:
cd /usr/share/sddm/themes/breeze ; patch -p3 < /tmp/WIP_fix_undefined_to_int_log.patch

This is asuming you saved the patch in /tmp. You can also use patch -R to revert the patch, or just reinstall the sddm-theme-breeze package.

Happy hacking,
[1]: https://xkcd.com/349/

--
"It's a well-known fact that computing devices such as the abacus were
invented thousands of years ago. But it's not well known that the first use of
common computer protocol occurred in the Old Testament. This, of course, was
when Moses aborted the Egyptians' process with a control-sea."
-- Tom Galloway (recs.arts.comics, February 1992)
Saludos /\/\ /\ >< `/
commit 1ea89f08cce14e7e4017d6d3dc5b8cc22e1e902d
Author: Maximiliano Curia <maxy@gnuservers.com.ar>
Date:   Thu Nov 17 10:01:49 2016 +0100

    WIP: fix "Unable to assign [undefined] to int" log
    
    The sddm breeze theme battery icon is trying to access the battery
    percent. In a batteryless system it produces the syslog message:
    Nov 14 22:28:23 samd sddm-greeter[3210]: file:///usr/share/sddm/themes/breeze/components/Battery.qml:39:18: Unable to assign [undefined] to int
    
    Based on https://gist.github.com/Zren/4e5709d842965227088f6e1d3fd42016
    
    Debian-Bug: https://bugs.debian.org/844194

diff --git a/lookandfeel/contents/components/Battery.qml b/lookandfeel/contents/components/Battery.qml
index c4a94eb..c1bbf73 100644
--- a/lookandfeel/contents/components/Battery.qml
+++ b/lookandfeel/contents/components/Battery.qml
@@ -33,10 +33,19 @@ Row {
         connectedSources: ["Battery", "AC Adapter"]
     }
 
+    function getBatteryData(key, def) {
+        var value = pmSource.data.Battery[key]
+        if (typeof value === "undefined") {
+            return def;
+        } else {
+            return value;
+        }
+    }
+
     PW.BatteryIcon {
         id: battery
-        hasBattery: true
-        percent: pmSource.data["Battery"]["Percent"]
+        hasBattery: getBatteryData("Has Battery", false)
+        percent: getBatteryData("Percent", 100)
         pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false
 
         height: batteryLabel.height

Attachment: signature.asc
Description: PGP signature


Reply to: