pimutils / khal

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

Crash on deleting multiple occurrences of repeating event #1288

Closed emiham closed 1 year ago

emiham commented 1 year ago

Describe the bug If you have a repeating event and try to delete two occurrences, khal crashes after deleting the first one. Possibly related to #1184.

Stack Trace

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/khal/ui/__init__.py", line 1363, in start_pane
    loop.run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 320, in run
    self._run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 423, in _run
    self.event_loop.run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/select_loop.py", line 148, in run
    self._loop()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/select_loop.py", line 189, in _loop
    self._watch_files[fd]()
  File "/usr/lib/python3.11/site-packages/urwid/raw_display.py", line 435, in <lambda>
    wrapper = lambda: self.parse_input(
                      ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/raw_display.py", line 534, in parse_input
    callback(processed, processed_codes)
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 450, in _update
    self.process_input(keys)
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 565, in process_input
    something_handled |= bool(self.unhandled_input(k))
                              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 611, in unhandled_input
    return self._unhandled_input(input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/khal/ui/base.py", line 205, in on_key_press
    self.backtrack()
  File "/usr/lib/python3.11/site-packages/khal/ui/base.py", line 190, in backtrack
    cb(data)
  File "/usr/lib/python3.11/site-packages/khal/ui/__init__.py", line 1117, in cleanup
    self.collection.delete_instance(href, etag, account, rec_id)
  File "/usr/lib/python3.11/site-packages/khal/khalendar/khalendar.py", line 255, in delete_instance
    raise EtagMissmatch()
khal.khalendar.exceptions.EtagMissmatch

To Reproduce

  1. Create a repeating event
  2. Delete two of them, choosing "Only this" when prompted
  3. Close khal

Expected behavior Both events are cleanly deleted.

OS, version, khal version and how you installed it:

[[Default]] path = ~/.local/share/calendars/default/default/ color = yellow

...

[default] show_all_days = false highlight_event_days = true

[locale] timeformat = %H:%M dateformat = %Y-%m-%d longdateformat = %Y-%m-%d datetimeformat = %Y-%m-%d %H:%M longdatetimeformat = %Y-%m-%d %H:%M weeknumbers = left

[view] agenda_event_format = {calendar-color}{cancelled}{start-end-time-style} {title}{repeat-symbol}{alarm-symbol}{reset} frame = width bold_for_light_color = false

[keybindings]


 - Other package versions: python-urwid 2.1.2.r56.gabc098c-1, also from Arch repo. Let me know if you need info about other packages. 
WhyNotHugo commented 1 year ago

There were some fixes related to deleting a single instance in a recurring event some weeks ago.

Can you try the latest master? I think pipx install git+https://github.com/pimutils/khal should work.

That worked for this similar issue: https://github.com/pimutils/khal/issues/1286

emiham commented 1 year ago

Yes, the latest master seems to work. Thank you for your quick response!