pimutils / khal

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

When deleting 2 or more instances of a recurring event, only the first instance is deleted. #1290

Closed ei14 closed 1 year ago

ei14 commented 1 year ago

Describe the bug When deleting 2 or more instances of a recurring event, only the first instance is deleted. It seems that upon quitting, some time after ikhal makes the write for the first deletion, ikhal crashes before it is able to make the write for the second deletion.

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

Expected behavior The event in the above example should've been deleted on both dates, as would be possible if deleting multiple instances of a recurring event was possible.

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

[locale] timeformat = %I:%M %p dateformat = %m/%d/%Y longdateformat = %m/%d/%Y datetimeformat = %m/%d/%Y %I:%M %p longdatetimeformat = %m/%d/%Y %I:%M %p local_timezone = CST6CDT firstweekday = 6

 - Output of `pip freeze`:

aiohttp==3.8.4 aiosignal==1.3.1 aiostream==0.4.5 appdirs==1.4.4 arviz==0.15.1 asgiref==3.7.2 astroid==2.15.6 async-timeout==4.0.2 atomicwrites==1.4.1 attrs==22.2.0 autocommand==2.2.2 beautifulsoup4==4.12.2 blinker==1.5 bottle==0.12.25 Brotli==1.0.9 certifi==2023.7.22 cffi==1.15.1 cftime==1.6.2 chardet==5.1.0 charset-normalizer==3.2.0 click==8.1.5 click-log==0.4.0 clint==0.5.1 colorama==0.4.6 configobj==5.0.8 contourpy==1.1.0 cppman==0.5.6 cryptography==41.0.2 cssselect==1.2.0 cycler==0.11.0 Cython==3.0.0 dacite==1.8.1 dbus-python==1.3.2 decorator==5.1.1 dill==0.3.6 docopt==0.6.2 einops==0.7.0rc1 evdev==1.6.1 fastjsonschema==2.18.0 Flask==2.2.5 fonttools==4.41.1 frozenlist==1.3.3 gitdb==4.0.10 GitPython==3.1.32 gmpy2==2.1.5 h11==0.14.0 h2==4.1.0 hpack==4.0.0 html5lib==1.1 hyperframe==6.0.1 icalendar==5.0.7 idna==3.4 importlib-metadata==5.0.0 inflect==6.1.0 iniconfig==2.0.0 isodate==0.6.1 isort==5.12.0 itsdangerous==2.1.2 jaraco.context==4.3.0 jaraco.functools==3.8.0 jaraco.text==3.11.1 jedi==0.18.2 Jinja2==3.1.2 kaitaistruct==0.10 khal==0.11.2 kiwisolver==1.4.4 lazy-object-proxy==1.9.0 ldap3==2.9 lensfun==0.3.4 lit==15.0.7.dev0 llvmlite==0.40.0rc1 lxml==4.9.2 Mako==1.2.4 Markdown==3.4.3 MarkupSafe==2.1.3 matplotlib==3.7.2 mccabe==0.7.0 mido==1.3.0 mitmproxy==9.0.1 mitmproxy_wireguard==0.1.22 more-itertools==9.1.0 mpmath==1.3.0 msgpack==1.0.5 multidict==6.0.4 mutagen==1.46.0 netCDF4==1.6.3 numba==0.57.1 numpy==1.25.1 oauthlib==3.2.2 ordered-set==4.1.0 packaging==23.1 pandas==1.5.3 parso==0.8.3 passlib==1.7.4 pathvalidate==3.1.0 Pillow==10.0.0 Pivy==0.6.8 platformdirs==3.9.1 pluggy==1.0.0 ply==3.11 pooch==1.7.0 protobuf==4.23.4 publicsuffix2==2.20191221 pyasn1==0.4.8 pybind11==2.11.1 pycairo==1.23.0 pycparser==2.21 pydantic==1.10.9 pyfiglet==0.8.post1 pygame==2.4.0 PyGObject==3.44.1 pyliblo==0.10.0 pylint==2.17.4 pyOpenSSL==23.2.0 pyparsing==3.0.9 pyperclip==1.8.2 PyQt5==5.15.9 PyQt5-sip==12.12.1 PySide2==5.15.10 pytest==7.4.0 python-dateutil==2.8.2 python-rtmidi==1.5.4 python-xlib==0.33 pytz==2023.3 pytz-deprecation-shim==0.1.0.post0 pyxdg==0.28 PyYAML==6.0 rdflib==6.2.0 requests==2.28.2 requests-oauthlib==1.3.1 requests-toolbelt==1.0.0 ruamel.yaml==0.17.22 ruamel.yaml.clib==0.2.7 scdl==2.7.3 scipy==1.11.1 screenkey==1.5 shiboken2==5.15.10 simplejson==3.19.1 six==1.16.0 smmap==5.0.0 sortedcontainers==2.4.0 soundcloud-v2==1.3.0 soupsieve==2.4.1 speedtest-cli==2.1.3 sympy==1.12 TBB==0.2 termcolor==2.3.0 termdown==1.18.0 toml==0.10.2 tomli==2.0.1 tomlkit==0.11.8 tornado==6.2 trove-classifiers==2023.7.8 typing_extensions==4.7.1 tzdata==2023.3 tzlocal==5.0.1 urllib3==1.26.15 urlscan==1.0.0 urwid==2.1.3.dev0 validate==5.0.8 validate-pyproject==0.13.post1.dev0+gb752273.d20230520 vdirsyncer==0.19.2 watchdog==2.3.0 webencodings==0.5.1 Werkzeug==2.3.2 wrapt==1.14.1 wsproto==1.2.0 wxPython==4.2.0 xarray==2023.1.0 xarray-einstats==0.5.1 yarl==1.9.2 yt-dlp==2023.7.6 zipp==3.16.0 zstandard==0.21.0

ei14 commented 1 year ago

A cumbersome workaround: Delete the first instance of the event, then quit the app. Reopen and delete the second instance. This is repeatable and appears to work reliably, just as long as, specifically, no more than 1 instance of the same event is deleted without restarting the app.

ei14 commented 1 year ago

I tried again with khal, version 0.11.3.div39+g8fcfc8f on a fresh VirtualBox install of Debian 11, and I was unable to reproduce the bug. It appears the issue was fixed in version 0.11.3. (Should I delete this issue entirely?)

geier commented 1 year ago

Thanks for reporting this. I thought we fixed this already with 0.11.2, but then it looks like it's time for a new release.

Leave it as it is, not a problem.