Bug#925943: nfs-common: nfsiostat crashes due to using reserved word 'list' as variable name
Package: nfs-utils
Version: 1:1.3.4-2.3
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch
Dear Maintainer,
nfsiostat, in nfs-common-1.3.4-2, is broken in bionic, cosmic and disco.
When you run the command nfsiostat, either as root or a regular user, the following traceback is printed:
$ nfsiostat
Traceback (most recent call last):
File "/usr/sbin/nfsiostat", line 640, in <module>
iostat_command(prog)
File "/usr/sbin/nfsiostat", line 593, in iostat_command
devices = list_nfs_mounts(origdevices, mountstats)
File "/usr/sbin/nfsiostat", line 495, in list_nfs_mounts
for device, descr in list(mountstats.items()):
TypeError: 'list' object is not callable
This is caused by the 'list' reserved word being used as a variable name in list_nfs_mounts(),
and is explained here: https://askubuntu.com/questions/1123319/nfsiostat-failing-on-18-04/1123336#1123336?s=a1e9150fbf284e849efe6fe084e7c7b8
I have sent a patch upstream to fix this, and it was commited in:
http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commitdiff;h=c4c14011b70375050d7bba7c57e2eaf4c715dc7c
In Ubuntu, the attached patch was applied to achieve the following:
* nfsiostat-replace-list-reserved-word.patch: fix nfsiostat crash due to
using 'list' as a variable name. (LP: #1821261)
Please land this patch in debian to aid with the SRU process.
Thanks for considering the patch.
-- System Information:
Debian Release: buster/sid
APT prefers cosmic-updates
APT policy: (500, 'cosmic-updates'), (500, 'cosmic-security'), (500, 'cosmic'), (100, 'cosmic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.18.0-16-generic (SMP w/4 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), LANGUAGE=en_NZ:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru nfs-utils-1.3.4/debian/control nfs-utils-1.3.4/debian/control
--- nfs-utils-1.3.4/debian/control 2019-03-26 01:24:29.000000000 +1300
+++ nfs-utils-1.3.4/debian/control 2019-03-29 11:09:15.000000000 +1300
@@ -1,8 +1,7 @@
Source: nfs-utils
Priority: standard
Section: net
-Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
-XSBC-Original-Maintainer: Debian kernel team <debian-kernel@lists.debian.org>
+Maintainer: Debian kernel team <debian-kernel@lists.debian.org>
Uploaders: Anibal Monsalve Salazar <anibal@debian.org>, Ben Hutchings <ben@decadent.org.uk>, Steve Langasek <vorlon@debian.org>, Daniel Pocock <pocock@debian.org>
Build-Depends: debhelper (>= 9.20160709), libwrap0-dev, libevent-dev, libnfsidmap-dev (>= 0.24), libkrb5-dev, libblkid-dev, libkeyutils-dev, pkg-config, libldap2-dev, libcap-dev, libtirpc-dev (>= 1.0.2), libdevmapper-dev, dh-autoreconf, libmount-dev, libsqlite3-dev
Standards-Version: 4.2.1
diff -Nru nfs-utils-1.3.4/debian/patches/nfsiostat-replace-list-reserved-word.patch nfs-utils-1.3.4/debian/patches/nfsiostat-replace-list-reserved-word.patch
--- nfs-utils-1.3.4/debian/patches/nfsiostat-replace-list-reserved-word.patch 1970-01-01 12:00:00.000000000 +1200
+++ nfs-utils-1.3.4/debian/patches/nfsiostat-replace-list-reserved-word.patch 2019-03-29 11:08:23.000000000 +1300
@@ -0,0 +1,45 @@
+From c4c14011b70375050d7bba7c57e2eaf4c715dc7c Mon Sep 17 00:00:00 2001
+From: Matthew Ruffell <matthew.ruffell@canonical.com>
+Date: Thu, 28 Mar 2019 15:43:21 -0400
+Subject: [PATCH] nfsiostat: replace 'list' reserved word
+
+list is a reserved word in python and should not be used as a variable
+name. Changing list to devicelist for list_nfs_mounts()
+
+Fixes: https://bugs.launchpad.net/ubuntu/+source/nfs-utils/+bug/1821261
+
+Signed-off-by: Matthew Ruffell <matthew.ruffell@canonical.com>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+ tools/nfs-iostat/nfs-iostat.py | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+Index: nfs-utils-1.3.4/tools/nfs-iostat/nfs-iostat.py
+===================================================================
+--- nfs-utils-1.3.4.orig/tools/nfs-iostat/nfs-iostat.py
++++ nfs-utils-1.3.4/tools/nfs-iostat/nfs-iostat.py
+@@ -484,20 +484,20 @@ def list_nfs_mounts(givenlist, mountstat
+ return a full list if the given list is empty -
+ may return an empty list if none found
+ """
+- list = []
++ devicelist = []
+ if len(givenlist) > 0:
+ for device in givenlist:
+ stats = DeviceData()
+ stats.parse_stats(mountstats[device])
+ if stats.is_nfs_mountpoint():
+- list += [device]
++ devicelist += [device]
+ else:
+ for device, descr in list(mountstats.items()):
+ stats = DeviceData()
+ stats.parse_stats(descr)
+ if stats.is_nfs_mountpoint():
+- list += [device]
+- return list
++ devicelist += [device]
++ return devicelist
+
+ def iostat_command(name):
+ """iostat-like command for NFS mount points
diff -Nru nfs-utils-1.3.4/debian/patches/series nfs-utils-1.3.4/debian/patches/series
--- nfs-utils-1.3.4/debian/patches/series 2019-03-26 01:24:29.000000000 +1300
+++ nfs-utils-1.3.4/debian/patches/series 2019-03-29 11:02:25.000000000 +1300
@@ -19,3 +19,4 @@
glibc-2.28-compat.patch
truncate_uid.patch
truncate_uid_2.patch
+nfsiostat-replace-list-reserved-word.patch
Reply to: