pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.62k stars 207 forks source link

khal crash when "color" metadata file contains the value "None" #596

Closed samdmarshall closed 7 years ago

samdmarshall commented 7 years ago

I ran vdirsyncer metasync and got back a color value of "None" for one of my calendars (presumably this is also a bug in vdirsyncer, but it doesn't present an error when handling this). When this gets parsed by khal I get the following stack trace:

Traceback (most recent call last):
  File "/usr/local/bin/khal", line 11, in <module>
    load_entry_point('khal==0.9.2', 'console_scripts', 'khal')()
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/khal/cli.py", line 250, in cli
    ctx.invoke(cli.commands[command])
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/khal/cli.py", line 453, in interactive
    ctx.obj['conf']
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/khal/controllers.py", line 516, in interactive
    quit_keys=conf['keybindings']['quit'],
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/khal/ui/__init__.py", line 1492, in start_pane
    getattr(colors, pane._conf['view']['theme']), pane.collection)
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/khal/ui/__init__.py", line 1476, in _add_calendar_colors
    collection.hmethod))
  File "/usr/local/Cellar/khal/0.9.2/libexec/lib/python3.6/site-packages/khal/ui/__init__.py", line 1431, in _urwid_palette_entry
    r = int(color[1] * 2, 16)
ValueError: invalid literal for int() with base 16: 'oo'
untitaker commented 7 years ago

Yes this is absolutely a bug in vdirsyncer.

samdmarshall commented 7 years ago

ok, do you want me opening a separate issue on that as well?

untitaker commented 7 years ago

Yes please, also at the moment I'm unsure how to reproduce this.

samdmarshall commented 7 years ago

The khal issue can be reproduced by editing an existing calendar's color metadata file and replacing the contents with the string None. I will have to work out what caused vdirsyncer to write that value to the file, once I do I will open an issue on that.

samdmarshall commented 7 years ago

@untitaker ok i posted as much info as I could in a vdirsyncer bug report here: https://github.com/pimutils/vdirsyncer/issues/565 let me know if there is anything else needed!

geier commented 7 years ago

thank you for reporting this, will be fixed ASAP.

geier commented 7 years ago

fixed with a7b3cc6060743feaae4b13dd667696160b88e1ca