torproject / nyx

Command-line monitor for Tor.
https://nyx.torproject.org/
GNU General Public License v3.0
122 stars 26 forks source link

config color_override causes crash #30

Closed saizai closed 4 years ago

saizai commented 4 years ago

~/.nyx/config

color_override cyan

result

Traceback (most recent call last):
  File "/usr/bin/nyx", line 11, in <module>
    load_entry_point('nyx==2.1.0', 'console_scripts', 'nyx')()
  File "/usr/lib/python3/dist-packages/nyx/__init__.py", line 176, in main
    nyx.starter.main()
  File "/usr/lib/python3/dist-packages/stem/util/conf.py", line 289, in wrapped
    return func(*args, config = config, **kwargs)
  File "/usr/lib/python3/dist-packages/nyx/starter.py", line 128, in main
    nyx.curses.start(nyx.draw_loop, acs_support = config.get('acs_support', True), transparent_background = True, cursor = False)
  File "/usr/lib/python3/dist-packages/nyx/curses.py", line 219, in start
    curses.wrapper(_wrapper)
  File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python3/dist-packages/nyx/curses.py", line 217, in _wrapper
    function()
  File "/usr/lib/python3/dist-packages/nyx/__init__.py", line 221, in draw_loop
    nyx.menu.show_menu()
  File "/usr/lib/python3/dist-packages/nyx/menu.py", line 210, in show_menu
    selection_x = _draw_top_menubar(menu, cursor.selection)
  File "/usr/lib/python3/dist-packages/nyx/menu.py", line 296, in _draw_top_menubar
    nyx.curses.draw(_render, height = 1, background = RED)
  File "/usr/lib/python3/dist-packages/nyx/curses.py", line 758, in draw
    curses_subwindow.bkgd(' ', curses_attr(background, HIGHLIGHT))
  File "/usr/lib/python3/dist-packages/nyx/curses.py", line 440, in curses_attr
    encoded |= _color_attr()[override if override else attr]
KeyError: 'cyan'
free(): invalid next size (fast)
$ nyx --version
nyx version 2.1.0 (released January 12, 2019)
atagar commented 4 years ago

Thanks Sai! Great catch. Fixed.

https://gitweb.torproject.org/nyx.git/commit/?id=ed031ca