This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new e26b42498f rpc: tolerate unsupported chmod on unix sockets (#12895)
e26b42498f is described below

commit e26b42498f6d04b87ae858179e0e6efc6144c8f5
Author: Brian Neradt <[email protected]>
AuthorDate: Thu Feb 19 18:03:30 2026 -0600

    rpc: tolerate unsupported chmod on unix sockets (#12895)
    
    test_jsonrpcserver can fail on containerized macOS-host mounts where
    chmod() on an AF_UNIX socket inode returns EINVAL or ENOTSUP.
    When this happens, RPC server init aborts and the client test
    fails with connection refused.
    
    Treat unsupported chmod-on-socket errors as non-fatal and keep
    running with umask-derived permissions, while preserving fatal
    behavior for other chmod failures. Also zero-initialize
    sockaddr_un before use to avoid carrying stale bytes into bind().
---
 src/mgmt/rpc/server/IPCSocketServer.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mgmt/rpc/server/IPCSocketServer.cc 
b/src/mgmt/rpc/server/IPCSocketServer.cc
index c819c08fca..6b6ebbe7c2 100644
--- a/src/mgmt/rpc/server/IPCSocketServer.cc
+++ b/src/mgmt/rpc/server/IPCSocketServer.cc
@@ -140,6 +140,7 @@ std::error_code
 IPCSocketServer::init()
 {
   std::error_code ec; // Flag possible errors.
+  _serverAddr = {};
   // Need to run some validations on the pathname to avoid issue. Normally 
this would not be an issue, but some tests may fail on
   // this.
   if (_conf.sockPathName.empty() || _conf.sockPathName.size() > sizeof 
_serverAddr.sun_path) {
@@ -318,8 +319,13 @@ IPCSocketServer::bind(std::error_code &ec)
 
   mode_t mode = restricted ? 00700 : 00777;
   if (chmod(_conf.sockPathName.c_str(), mode) < 0) {
-    ec = std::make_error_code(static_cast<std::errc>(errno));
-    return;
+    // Some filesystems don't support chmod on AF_UNIX socket inodes.
+    // Keep running in that case and rely on default umask-derived permissions.
+    if (errno != EINVAL && errno != ENOTSUP && errno != EOPNOTSUPP) {
+      ec = std::make_error_code(static_cast<std::errc>(errno));
+      return;
+    }
+    Dbg(dbg_ctl, "chmod(%s) not supported on this filesystem: %s", 
_conf.sockPathName.c_str(), std::strerror(errno));
   }
 }
 

Reply via email to