diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bbf8ce0..ceaf93bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ * Fix: auth/htpasswd related to detection and use of bcrypt * Add: option [auth] ldap_ignore_attribute_create_modify_timestamp for support of Authentik LDAP server * Extend: [storage] hook supports now placeholder for "cwd" and "path" (and catches unsupported placeholders) +* Fix: location of lock file for in case of dedicated cache folder is activated +* Extend: log and create base folders if not existing during startup ## 3.5.0 diff --git a/radicale/storage/multifilesystem/__init__.py b/radicale/storage/multifilesystem/__init__.py index c5b8d439..a6191e77 100644 --- a/radicale/storage/multifilesystem/__init__.py +++ b/radicale/storage/multifilesystem/__init__.py @@ -147,8 +147,13 @@ class Storage( def __init__(self, configuration: config.Configuration) -> None: super().__init__(configuration) logger.info("Storage location: %r", self._filesystem_folder) - self._makedirs_synced(self._filesystem_folder) + if not os.path.exists(self._filesystem_folder): + logger.warning("Storage location: %r not existing, create now", self._filesystem_folder) + self._makedirs_synced(self._filesystem_folder) logger.info("Storage location subfolder: %r", self._get_collection_root_folder()) + if not os.path.exists(self._get_collection_root_folder()): + logger.warning("Storage location subfolder: %r not existing, create now", self._get_collection_root_folder()) + self._makedirs_synced(self._get_collection_root_folder()) logger.info("Storage cache subfolder usage for 'item': %s", self._use_cache_subfolder_for_item) logger.info("Storage cache subfolder usage for 'history': %s", self._use_cache_subfolder_for_history) logger.info("Storage cache subfolder usage for 'sync-token': %s", self._use_cache_subfolder_for_synctoken) @@ -170,7 +175,9 @@ class Storage( logger.debug("Storage cache action logging: %s", self._debug_cache_actions) if self._use_cache_subfolder_for_item is True or self._use_cache_subfolder_for_history is True or self._use_cache_subfolder_for_synctoken is True: logger.info("Storage cache subfolder: %r", self._get_collection_cache_folder()) - self._makedirs_synced(self._get_collection_cache_folder()) + if not os.path.exists(self._get_collection_cache_folder()): + logger.warning("Storage cache subfolder: %r not existing, create now", self._get_collection_cache_folder()) + self._makedirs_synced(self._get_collection_cache_folder()) if sys.platform != "win32": if not self._folder_umask: # retrieve current umask by setting a dummy umask diff --git a/radicale/storage/multifilesystem/lock.py b/radicale/storage/multifilesystem/lock.py index 1e25daee..0f7b56d9 100644 --- a/radicale/storage/multifilesystem/lock.py +++ b/radicale/storage/multifilesystem/lock.py @@ -38,10 +38,11 @@ class CollectionPartLock(CollectionBase): if self._storage._lock.locked == "w": yield return - cache_folder = os.path.join(self._filesystem_path, ".Radicale.cache") + cache_folder = self._storage._get_collection_cache_subfolder(self._filesystem_path, ".Radicale.cache", ns) self._storage._makedirs_synced(cache_folder) lock_path = os.path.join(cache_folder, ".Radicale.lock" + (".%s" % ns if ns else "")) + logger.debug("Lock file (CollectionPartLock): %r" % lock_path) lock = pathutils.RwLock(lock_path) with lock.acquire("w"): yield @@ -55,6 +56,7 @@ class StoragePartLock(StorageBase): def __init__(self, configuration: config.Configuration) -> None: super().__init__(configuration) lock_path = os.path.join(self._filesystem_folder, ".Radicale.lock") + logger.debug("Lock file (StoragePartLock): %r" % lock_path) self._lock = pathutils.RwLock(lock_path) self._hook = configuration.get("storage", "hook")