From e316b304d6480defb782c4cfec995fe6b6df3e6b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 28 Mar 2025 11:40:00 +0530 Subject: [PATCH] Use uid rather than user name which can be arbitrary length in socket path --- src/calibre/utils/ipc/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/ipc/__init__.py b/src/calibre/utils/ipc/__init__.py index 3843fc2395..30825da5c4 100644 --- a/src/calibre/utils/ipc/__init__.py +++ b/src/calibre/utils/ipc/__init__.py @@ -45,7 +45,7 @@ def socket_address(which): ans = '\0' + sock_name else: # tempdir already contains calibre in its path - sock_name = '{}-{}.sock'.format(ascii_filename(user).replace(' ', '_'), which) + sock_name = f'{os.getuid()}-{which}.sock' from tempfile import gettempdir tmp = force_unicode(gettempdir(), filesystem_encoding) ans = os.path.join(tmp, sock_name)