1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-09-15 20:36:55 +00:00

catch permissions errors and display owner+user information

This commit is contained in:
Peter Bieringer 2025-06-29 08:35:26 +02:00
parent 9c50f154fd
commit e36d5f2c01
2 changed files with 12 additions and 3 deletions

View file

@ -22,7 +22,7 @@ import sys
from tempfile import TemporaryDirectory
from typing import IO, AnyStr, ClassVar, Iterator, Optional, Type
from radicale import config, pathutils, storage, types
from radicale import config, logger, pathutils, storage, types, utils
from radicale.storage import multifilesystem # noqa:F401
@ -161,7 +161,13 @@ class StorageBase(storage.BaseStorage):
# Create parent dirs recursively
self._makedirs_synced(parent_filesystem_path)
# Possible race!
os.makedirs(filesystem_path, exist_ok=True)
try:
os.makedirs(filesystem_path, exist_ok=True)
except PermissionError as e:
logger.error("Directory permissions: %s / Effective user: %s", pathutils.path_permissions_as_string(parent_filesystem_path), utils.user_groups_as_string())
raise e
except Exception:
raise
self._sync_directory(parent_filesystem_path)
if sys.platform != "win32" and self._folder_umask:
os.umask(oldmask)