element-hq / element-hq/synapse
`python3 -m synapse.config` attempts to create directories for the media store
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#12862](https://github.com/matrix-org/synapse/issues/12862).
---
`python3 -m synapse.config -c homeserver.yaml` should just validate the config, but it also attempts to create directories:
```
$ python3 -m synapse.config -c ~/src/nixpkgs/homeserver.yaml
You have set two incompatible options, expiry_time and expire_caches. Please only use the expire_caches and cache_entry_ttl options and delete the expiry_time option as it is deprecated.
Expiry_time is a deprecated option, please use the expire_caches and cache_entry_ttl options instead.
Traceback (most recent call last):
File "/nix/store/wnrc4daqbd6v5ifqlxsj75ky8556zy0p-python3-3.9.12/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/nix/store/wnrc4daqbd6v5ifqlxsj75ky8556zy0p-python3-3.9.12/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/__main__.py", line 56, in
main(sys.argv)
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/__main__.py", line 30, in main
config = HomeServerConfig.load_config("", load_config_args)
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/_base.py", line 461, in load_config
obj, _ = cls.load_config_with_parser(config_parser, argv)
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/_base.py", line 532, in load_config_with_parser
obj.parse_config_dict(
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/_base.py", line 718, in parse_config_dict
self.invoke_all(
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/_base.py", line 347, in invoke_all
res[config_class.section] = getattr(config, func_name)(*args, **kwargs)
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/repository.py", line 120, in read_config
self.media_store_path = self.ensure_directory(
File "/tmp/venv/lib/python3.9/site-packages/synapse/config/_base.py", line 199, in ensure_directory
os.makedirs(dir_path, exist_ok=True)
File "/nix/store/wnrc4daqbd6v5ifqlxsj75ky8556zy0p-python3-3.9.12/lib/python3.9/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/nix/store/wnrc4daqbd6v5ifqlxsj75ky8556zy0p-python3-3.9.12/lib/python3.9/os.py", line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/lib/matrix-synapse'
```
This prevents its use on another machine or in a sandbox.
Contributor guide
Assessment
This issue has not been assessed yet.