etesync / etesync-dav

This is a CalDAV and CardDAV adapter for EteSync
https://www.etesync.com
GNU General Public License v3.0
285 stars 45 forks source link

After updating to python3.10, etesync-dav doesn't sync anymore #248

Closed opiechow closed 2 years ago

opiechow commented 2 years ago

Hi,

I suspect this issue started to occur after I have updated python. At first my venv setup wouldn't run at all, so I decided to configure a new one. The problem occurs also after doing a fresh installation (after clearing .config) of etesync-dav via venv method.

Attaching debug log from the crashing thread (with Etesync and Linux username replaced with 'xyzzy'):

[2022-01-14 14:04:56 +0100] [40823/Thread-38 (process_request_thread)] [DEBUG] Request headers:
{'CONTENT_LENGTH': '239',
 'CONTENT_TYPE': 'application/xml; charset=utf-8',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
 'HTTP_AUTHORIZATION': 'Basic **masked**',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_DEPTH': '1',
 'HTTP_HOST': 'localhost:37358',
 'HTTP_ORIGIN': 'http://localhost:37358',
 'HTTP_PRAGMA': 'no-cache',
 'HTTP_PREFER': 'return=minimal',
 'HTTP_SEC_FETCH_DEST': 'empty',
 'HTTP_SEC_FETCH_MODE': 'cors',
 'HTTP_SEC_FETCH_SITE': 'same-origin',
 'HTTP_USER_AGENT': 'Thunderbird CalDAV/CardDAV',
 'HTTP_X_ENFORCEAUTHENTICATION': 'True',
 'PATH_INFO': '/xyzzy/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': '',
 'REQUEST_METHOD': 'PROPFIND',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'localhost',
 'SERVER_PORT': '37358',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.2',
 'wsgi.errors': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
 'wsgi.file_wrapper': <class 'wsgiref.util.FileWrapper'>,
 'wsgi.input': <_io.BufferedReader name=7>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}
[2022-01-14 14:04:56 +0100] [40823/Thread-38 (process_request_thread)] [DEBUG] Sanitized script name: ''
[2022-01-14 14:04:56 +0100] [40823/Thread-38 (process_request_thread)] [DEBUG] Sanitized path: '/xyzzy/'
[2022-01-14 14:04:56 +0100] [40823/Thread-38 (process_request_thread)] [INFO] Successful login: 'xyzzy'
[2022-01-14 14:04:56 +0100] [40823/Thread-38 (process_request_thread)] [DEBUG] Request content:
<?xml version="1.0"?>
<propfind xmlns="DAV:" xmlns:CS="http://calendarserver.org/ns/" xmlns:ICAL="http://apple.com/ns/ical/">
  <prop>
    <current-user-privilege-set />
    <resourcetype />
    <displayname />
    <ICAL:calendar-color />
    <CS:source />
  </prop>
</propfind>

[2022-01-14 14:04:56 +0100] [40823/Thread-38 (process_request_thread)] [DEBUG] 'xyzzy' has write access to collection 'xyzzy'
[2022-01-14 14:04:56 +0100] [40823/Thread-38 (process_request_thread)] [ERROR] An exception occurred during PROPFIND request on '/xyzzy/': can't set attribute 'tag'
Traceback (most recent call last):
  File "/home/xyzzy/Progs/etesync-venv/lib/python3.10/site-packages/radicale/app/__init__.py", line 105, in __call__
    status_text, headers, answers = self._handle_request(environ)
  File "/home/xyzzy/Progs/etesync-venv/lib/python3.10/site-packages/radicale/app/__init__.py", line 275, in _handle_request
    status, headers, answer = function(
  File "/home/xyzzy/Progs/etesync-venv/lib/python3.10/site-packages/radicale/app/propfind.py", line 390, in do_PROPFIND
    xml_answer = xml_propfind(base_prefix, path, xml_content,
  File "/home/xyzzy/Progs/etesync-venv/lib/python3.10/site-packages/radicale/app/propfind.py", line 69, in xml_propfind
    for item, permission in allowed_items:
  File "/home/xyzzy/Progs/etesync-venv/lib/python3.10/site-packages/radicale/app/propfind.py", line 329, in _collect_allowed_items
    for item in items:
  File "/home/xyzzy/Progs/etesync-venv/lib/python3.10/site-packages/etesync_dav/radicale/storage.py", line 557, in discover
    yield cls(self, posixpath.join(path, journal.uid))
  File "/home/xyzzy/Progs/etesync-venv/lib/python3.10/site-packages/etesync_dav/radicale/storage.py", line 264, in __init__
    self.tag = "VCALENDAR"
AttributeError: can't set attribute 'tag'

If this is relevant, I still haven't migrated to Etesync 2.0 and I am connecting to a self-hosted instance.

tasn commented 2 years ago

Are you on the latest version of etesync-dav? It was definitely fixed recently, though maybe only for etesync 2.0. Need to check after you respond.

opiechow commented 2 years ago

pip freeze says I'm on version: etesync-dav==0.32.0

In the meantime I recreated a venv for python3.8.12 and this is from this venv, didn't help, gets stuck with a similar issue.

opiechow commented 2 years ago

OK, I have applied the changes https://github.com/etesync/etesync-dav/commit/88cb99b9420ce8729b0d93708437285a1bcd7d4f to storage.py also and now it seems to work just fine, do you want me to submit a PR with this? :)

opiechow commented 2 years ago

https://github.com/etesync/etesync-dav/pull/249

tasn commented 2 years ago

Thanks a lot for the PR! I made a comment.