]> granicus.if.org Git - php/commitdiff
Allow fpm tests to be run with long socket path
authorMatteo Beccati <mbeccati@php.net>
Wed, 1 Apr 2020 16:14:25 +0000 (18:14 +0200)
committerMatteo Beccati <mbeccati@php.net>
Thu, 2 Apr 2020 14:16:42 +0000 (16:16 +0200)
Socket path is restricted to ~100 bytes, so we can use
the system temp dir if the path ends up too long.

sapi/fpm/tests/tester.inc

index e553e94f154673cad3f5f01ffcba7c671d01e9fb..d63e8a72505850609df904c5a44b50c4a03f00da 100644 (file)
@@ -856,7 +856,17 @@ class Tester
     {
         $port = $this->getPort($type, $pool, true);
         if ($type === 'uds') {
-            return $this->getFile($port . '.sock');
+            $address = $this->getFile($port . '.sock');
+
+            // Socket max path length is 108 on Linux and 104 on BSD,
+            // so we use the latter
+            if (strlen($address) <= 104) {
+                return $address;
+            }
+
+            return sys_get_temp_dir().'/'.
+                hash('crc32', dirname($address)).'-'.
+                basename($address);
         }
 
         return $this->getHost($type) . ':' . $port;