Skip to content

Commit

Permalink
ovs-bugtool: Fix crash when enable --ovs.
Browse files Browse the repository at this point in the history
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: 1ca0323 ("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>
  • Loading branch information
williamtu authored and igsilya committed Nov 5, 2020
1 parent 2eebece commit c4bc03d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utilities/bugtool/ovs-bugtool.in
Expand Up @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit c4bc03d

Please sign in to comment.