@@ -28978,13 +28978,28 @@ async function setup() {
2897828978 const tmpdir = process.env["RUNNER_TEMP"] ?? os.tmpdir();
2897928979 switch (pushMode) {
2898028980 case PushMode.Daemon: {
28981- const daemonDir = await fs.mkdtemp(path.join(tmpdir, "cachix-daemon-"));
28981+ const daemonDirPrefix = "cachix";
28982+ const socketName = "daemon.sock";
28983+ let daemonDir = await fs.mkdtemp(path.join(tmpdir, daemonDirPrefix));
28984+ let socketPath = path.join(daemonDir, socketName);
28985+ // Unix socket paths are limited to:
28986+ // 108 characters on Linux
28987+ // 104 characters on BSD/macOS
28988+ // If the path is too long, recreate in os.tmpdir() instead.
28989+ const maxSocketPathLen = os.platform() === "linux" ? 108 : 104;
28990+ if (socketPath.length > maxSocketPathLen) {
28991+ const oldSocketPath = socketPath;
28992+ await fs.rm(daemonDir, { recursive: true });
28993+ daemonDir = await fs.mkdtemp(path.join(os.tmpdir(), daemonDirPrefix));
28994+ socketPath = path.join(daemonDir, socketName);
28995+ core.warning(`Socket path too long (${oldSocketPath.length} > ${maxSocketPathLen} chars), using shorter path: ${oldSocketPath} -> ${socketPath}`);
28996+ }
2898228997 const daemonLog = (0, node_fs_1.openSync)(`${daemonDir}/daemon.log`, "a");
2898328998 const daemon = (0, node_child_process_1.spawn)(cachixBin, [
2898428999 "daemon",
2898529000 "run",
2898629001 "--socket",
28987- `${daemonDir}/daemon.sock` ,
29002+ socketPath ,
2898829003 name,
2898929004 ...splitArgs(cachixArgs),
2899029005 ], {
@@ -29080,6 +29095,7 @@ async function upload() {
2908029095 // Wait a bit for the logs to flush through
2908129096 await waitFor(1000);
2908229097 daemonLog.unwatch();
29098+ await fs.rm(daemonDir, { recursive: true });
2908329099 }
2908429100 break;
2908529101 }
0 commit comments