Package: smem
Version: 1.5-1
Severity: important
Tags: patch

Hello,

Attempts to generate bar graph (option --bar) cause smem to crash with a
traceback:

Traceback (most recent call last):
  File "/usr/bin/smem", line 727, in <module>
    showpids()
  File "/usr/bin/smem", line 299, in showpids
    showtable(pt.keys(), fields, columns.split(), options.sort or 'pss')
  File "/usr/bin/smem", line 558, in showtable
    showbar(l, columns, sort)
  File "/usr/bin/smem", line 649, in showbar
    for n in xrange(len(rc)):
NameError: name 'xrange' is not defined

This happens because the Debian version of smem uses Python 3, which
deprecated the xrange() function.

Patch attached.

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (200, 'testing'), (150, 'stable'), (90, 'unstable'), (70, 
'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-8-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages smem depends on:
ii  python3  3.8.2-2

Versions of packages smem recommends:
ii  python3-matplotlib  3.1.2-2

smem suggests no packages.

-- no debconf information
--- original/smem       2020-04-18 12:20:22.524849106 -0700
+++ fixed/smem  2020-04-18 12:19:24.912251338 -0700
@@ -646,7 +646,7 @@
 
     pl = []
     ind = numpy.arange(len(l))
-    for n in xrange(len(rc)):
+    for n in range(len(rc)):
         pl.append(pylab.bar(ind + offset + width * n,
                              [x[1][rc[n]] for x in l], width, color=gc(n)))
 

Reply via email to