2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ovs-bugtool: Fix crash when enable --ovs.

When enabling '--ovs' or when not using '-y', ovs-bugtool crashes due to
Traceback (most recent call last):
  File "/usr/local/sbin/ovs-bugtool", line 1410, in <module>
    sys.exit(main())
  File "/usr/local/sbin/ovs-bugtool", line 690, in main
    for (k, v) in data.items():
RuntimeError: dictionary changed size during iteration

The patch fixes it by making a copy of the key and value.

VMware-BZ: #2663359
Fixes: 1ca0323e7c ("Require Python 3 and remove support for Python 2.")
Acked-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
William Tu
2020-11-04 15:16:15 -08:00
committed by Ilya Maximets
parent 2eebece5a3
commit c4bc03d872

View File

@@ -686,8 +686,8 @@ exclude those logs from the archive.
ovs_info_caps = [CAP_NETWORK_STATUS, CAP_SYSTEM_LOGS,
CAP_OPENVSWITCH_LOGS, CAP_NETWORK_CONFIG]
ovs_info_list = ['process-tree']
# We cannot use iteritems, since we modify 'data' as we pass through
for (k, v) in data.items():
# We cannot use items(), since we modify 'data' as we pass through
for (k, v) in list(data.items()):
cap = v['cap']
if 'filename' in v:
info = k[0]
@@ -707,8 +707,8 @@ exclude those logs from the archive.
pass
# permit the user to filter out data
# We cannot use iteritems, since we modify 'data' as we pass through
for (k, v) in data.items():
# We cannot use items(), since we modify 'data' as we pass through
for (k, v) in list(data.items()):
cap = v['cap']
if 'filename' in v:
key = k[0]