Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menuconfig: Exception when leaving menu of choice with multiple definitions #93

Open
leandrolanzieri opened this issue May 22, 2020 · 0 comments

Comments

@leandrolanzieri
Copy link

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 added a commit to leandrolanzieri/Kconfiglib that referenced this issue May 22, 2020
This adds a catch to an exception that might occur when leaving a menu
which is not shown by the parent menu. For an example of this refer to
issue ulfalizer#93.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant