From 144c6e8f761ac552c31247295c9f40aa385013c0 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 29 Jul 2026 15:19:55 -0400 Subject: [PATCH] python-common/smb: work around socket path length limits for grpc lib The grpc library (at least the version on centos/rocky 10) has a limit of 107 characters. Even a fairly short host name is going to be close to this limit due to the UUID and service name in the path. Because the tool doesn't do much else and it is safe, the workaround is to chdir to into the parent dir of the socket and only pass the relative path name of socket. Fixes: https://tracker.ceph.com/issues/78857 Signed-off-by: John Mulligan --- src/python-common/ceph/smb/ctl/__main__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/python-common/ceph/smb/ctl/__main__.py b/src/python-common/ceph/smb/ctl/__main__.py index db2eb0edd9b2..94d8f5262bbc 100644 --- a/src/python-common/ceph/smb/ctl/__main__.py +++ b/src/python-common/ceph/smb/ctl/__main__.py @@ -182,7 +182,14 @@ class Context: f' {len(matches)} sockets found', hints=['select clusters using the --cluster option'], ) - return matches[0] + socket = matches[0] + # workaround for socket length issues in gRPC library. Because the path + # will typically include a long(ish) UUID and a possibly long service + # name we can changedir to the parent and only pass the file name along + # to grpc. This should be safe as this tool doesn't do much file system + # ops beyond this point. + os.chdir(socket.parent) + return socket.relative_to(socket.parent) def _ceph_keyrings(self, searchdir: pathlib.Path) -> list[pathlib.Path]: try: -- 2.47.3