Repository navigation
Keep the control socket in a private folder - #62
Conversation
|
Windows test result: failure at compile time of the test step. Command (in a checkout of cc7dbe9, Zig 0.17.0, x86_64-windows): The test "the control path depends on the project folder" in The source line: const base = if (std.c.getenv("TMPDIR")) |t| std.mem.sliceTo(t, 0) else "/tmp";
const home = try std.fmt.allocPrint(a, "{s}/dockyard-test-home-{d}", .{ base, std.c.getpid() }); |
|
macOS QA ran this PR at cc7dbe9 on macOS 27 on an Apple M1.
On macOS, /tmp is a link to /private/tmp, so pwd in the shell prints /private/tmp/... and the test looks for /tmp/... This does not come from this PR. main at f33ed61 fails the same test on this Mac (see #60). |
Without a private XDG_RUNTIME_DIR the socket goes to dockyard/run below the state folder (Linux) or ~/Library/Caches (macOS), a folder of mode 0700 that dockyard makes and checks. A client connects only to a socket file of its user that is not a link.
The test home folder is /tmp/dockyard-test-home-PID when TMPDIR is not set. The socket path then starts with "/tmp/dockyard-", and the old check of that prefix failed. The test now checks that the socket is not in /tmp itself and that it is below the home folder. It also removes the home folder at the end.
cc7dbe9 to
0d9209f
Compare
|
The branch is now on main (0aa6a53). The rebase had one conflict in The failure of "the control path depends on the project folder" was in the test, and the rebase did not cause it. When TMPDIR is not set, the test home folder is Local run on Linux: |
|
Windows test result on 0d9209f: the same compile error as on cc7dbe9, in the test step. Commands (Zig 0.17.0, x86_64-windows; the test command with an emptied cache):
|
The Windows build of the tests has no libc, so std.c.getenv and std.c.getpid do not compile there. On Windows the control path does not use the home folder, so the test uses a plain name.
Part of #15.
Without
XDG_RUNTIME_DIR, or when that folder is not a private folder of the user, the control socket of the preview went to/tmp/dockyard-UID-HASH.sock. It now goes todockyard/runbelowXDG_STATE_HOMEor~/.local/stateon Linux, and below~/Library/Cacheson macOS.sock.privateDirmakes that folder (mode 0700) and checks it: a folder, not a link, of the user, with no rights for others.sock.connectconnects only to a socket file of the user that is not a link.host.controlPathtakes the folders of the environment (host.Dirs), so the window, the preview child, anddockyard --mcpcompute the same path from the same environment.Local checks: aarch64-macos and x86_64-windows builds pass. In the last test run, 26 passed and 2 failed. One failure was the
--mcptest, whose child had no HOME; the last commit gives it the HOME of the test, and that fix is not run locally because builds are paused on this host. The other failure was the exec event of a short program in the helper test: it also fails on other branches under the load of this host, and the helper is unchanged here.