From 6c2c07430afb6b7b42bd9e825748f3e9dd412cf6 Mon Sep 17 00:00:00 2001 From: bvn13 Date: Wed, 24 Jun 2026 11:09:44 +0300 Subject: [PATCH] Fix save on Docker bind-mount: write in-place instead of atomic rename os.replace (rename) changes the inode which Docker bind-mounts prohibit (EBUSY). Write directly to the file instead; a single-process writer with RLock is safe without atomic rename. Co-Authored-By: Claude Sonnet 4.6 --- src/settings/config.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/settings/config.py b/src/settings/config.py index ea09fee..b7b8fce 100644 --- a/src/settings/config.py +++ b/src/settings/config.py @@ -1,6 +1,4 @@ import json -import os -import tempfile import threading from typing import Optional @@ -120,13 +118,5 @@ class Config(): def __save(self) -> None: with self.__lock: - directory = os.path.dirname(os.path.abspath(self.__filename)) - fd, tmp_path = tempfile.mkstemp(dir=directory, suffix='.tmp') - try: - with os.fdopen(fd, 'w') as f: - json.dump(self.__config, f, ensure_ascii=False, indent=4) - os.replace(tmp_path, self.__filename) - except Exception: - if os.path.exists(tmp_path): - os.remove(tmp_path) - raise + with open(self.__filename, 'w', encoding='utf-8') as f: + json.dump(self.__config, f, ensure_ascii=False, indent=4)