Bug#234484: gdesklets: /proc/cpuinfo not parsed on Linux/PPC, also bad byte order for IP address

Derrik Pates Derrik Pates <dpates@dsdk12.net>, 234484@bugs.debian.org
Tue, 24 Feb 2004 00:07:07 -0500


This is a multi-part MIME message sent by reportbug.

--===============0378634440==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: gdesklets
Version: 0.26-1
Severity: minor


I was shown gdesklets today at work, so I decided to get it set up on my
PowerBook. However, I noticed a few problems that, with a little time, I
found were rooted in the libdesklets common code. First, I'll be
attaching a patch that fixes libdesklets/CPU.py to parse /proc/cpuinfo
appropriately for Linux on PowerPC systems (so for example, the CPU info
applet shows "PowerPC 740/750 @ 400MHz" on my Pismo). Also, I noticed
that libdesklets/Network.py gets the IP address and feeds it back to the
caller in such a way that on a big-endian system, the individual bytes
of the IP address are reversed. I'm not a big Python developer, so I
don't know the right way to handle this, but this should really be fixed
(I handled it by swapping around the ordering of the individual bytes in
the returned address strings, but that's not really the right way
either).

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.2-ben1
Locale: LANG=C, LC_CTYPE=C

Versions of packages gdesklets depends on:
ii  gnome-utils                 2.4.1-1      GNOME desktop utilities
ii  libart-2.0-2                2.3.16-1     Library of functions for 2D graphi
ii  libatk1.0-0                 1.4.1-1      The ATK accessibility toolkit
ii  libbonobo2-0                2.4.3-1      Bonobo CORBA interfaces library
ii  libbonoboui2-0              2.4.3-2      The Bonobo UI library
ii  libc6                       2.3.2.ds1-11 GNU C Library: Shared libraries an
ii  libgconf2-4                 2.4.0.1-4    GNOME configuration database syste
ii  libgcrypt1                  1.1.12-4     LGPL Crypto library - runtime libr
ii  libglib2.0-0                2.2.3-1      The GLib library of C routines
ii  libgnome2-0                 2.4.0-4      The GNOME 2 library - runtime file
ii  libgnomecanvas2-0           2.4.0-1      A powerful object-oriented display
ii  libgnomeui-0                2.4.0.1-6    The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0              2.4.1-4.1    The GNOME virtual file-system libr
ii  libgnomevfs2-common         2.4.1-4.1    The GNOME virtual file-system libr
ii  libgnutls7                  0.8.12-5     GNU TLS library - runtime library
ii  libgtk2.0-0                 2.2.4-3      The GTK+ graphical user interface 
ii  libgtop2                    2.0.8-7      Libraries for gtop system monitori
ii  libice6                     4.3.0-2      Inter-Client Exchange library
ii  liborbit2                   1:2.8.3-2    libraries for ORBit2 - a CORBA ORB
ii  libpango1.0-0               1.2.5-2.1    Layout and rendering of internatio
ii  libpopt0                    1.7-4        lib for parsing cmdline parameters
ii  libsm6                      4.3.0-2      X Window System Session Management
ii  libtasn1-0                  0.1.2-1      Manage ASN.1 structures (runtime)
ii  libxml2                     2.6.6-1      GNOME XML library
ii  python                      2.3.3-5      An interactive high-level object-o
ii  python-gnome2               2.0.0-6      Python bindings for the Gnome 2 de
ii  python-gtk2                 2.0.0-3      Python bindings for the GTK+ widge
ii  python-numeric              23.1-1       Numerical (matrix-oriented) Mathem
ii  xlibs                       4.3.0-2      X Window System client libraries m
ii  zlib1g                      1:1.2.1-4    compression library - runtime

-- no debconf information


--===============0378634440==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gdesklets-cpu-py-fix.diff"

--- usr/share/gdesklets/libdesklets/CPU.py	2004-02-22 11:00:46.000000000 -0500
+++ /usr/share/gdesklets/libdesklets/CPU.py	2004-02-23 23:57:50.241371432 -0500
@@ -92,12 +92,20 @@
 
         # I've never seen any *BSD for PPC's. I need some help here.
         elif (arch == "ppc"):
-            fields = lines[0].split()
-            model_name = fields[2]
-            fields = lines[2].split()
-            cpu_mhz = fields[2]
-            fields = lines[10].split()
-            cpu_cache = fields[3]
+            if (platform == "Linux"):
+                fd = open("/proc/cpuinfo", "r")
+                lines = fd.readlines()
+                fd.close()
+                fields = lines[1].split()
+                model_name = " ".join(["PowerPC", fields[2]])
+                fields = lines[3].split()
+                cpu_mhz = fields[2]
+                fields = lines[10].split()
+                cpu_cache = fields[3]
+
+	    else:
+                print "Unknown OS, strange things may happen."
+                return
 
         else:
             # TODO: alpha, m68k, mips, ppc64, sparc

--===============0378634440==--