Kconfiglib icon indicating copy to clipboard operation
Kconfiglib copied to clipboard

menuconfig: Exception when leaving menu of choice with multiple definitions

Open leandrolanzieri opened this issue 4 years ago • 0 comments

Description

When a choice is given an associated symbol, it can have multiple definitions, so the options could be extended like so:

mainmenu "Main"

menu "Sub"
choice MY_CHOICE
    bool "Test choice"

config MY_OPT1
    bool "Option 1"

config MY_OPT2
    bool "Option 2"

endchoice
endmenu

choice MY_CHOICE
    default MY_OPT3

config MY_OPT3
    bool "Option 3"

endchoice

While using menuconfig, if one searches for MY_OPT3 and jumps to the symbol the choice menu will be displayed. If then one tries to leave the menu, an exception is raised, as the parent menu (top menu in this case) does not actually display the current menu.

Steps to reproduce

  1. Using the snippet above, run menuconfig
  2. Press / ('Jump to symbol') and search for MY_OPT3
  3. Jump to the symbol (pressing Enter)
  4. Leave the menu (pressing Esc)

Expected results

The Sub menu is displayed.

Actual results

An exception is raised and the program stops:

Traceback (most recent call last):
  File "/home/leandro/.local/bin/menuconfig", line 10, in <module>
    sys.exit(_main())
  File "/home/leandro/.local/lib/python3.7/site-packages/menuconfig.py", line 631, in _main
    menuconfig(standard_kconfig())
  File "/home/leandro/.local/lib/python3.7/site-packages/menuconfig.py", line 700, in menuconfig
    print(curses.wrapper(_menuconfig))
  File "/usr/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/leandro/.local/lib/python3.7/site-packages/menuconfig.py", line 859, in _menuconfig
    _leave_menu()
  File "/home/leandro/.local/lib/python3.7/site-packages/menuconfig.py", line 1174, in _leave_menu
    _sel_node_i = _shown.index(_cur_menu)
ValueError: <menu node for choice MY_CHOICE, deps y, has child, Kconfig:21> is not in list

leandrolanzieri avatar May 22 '20 12:05 leandrolanzieri