Kconfiglib
Kconfiglib copied to clipboard
menuconfig: Exception when leaving menu of choice with multiple definitions
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
- Using the snippet above, run menuconfig
- Press
/
('Jump to symbol') and search forMY_OPT3
- Jump to the symbol (pressing
Enter
) - 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