From 7323aa6b744b6248421f74eb9e9a4b3bba0c8b1c Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Tue, 26 Nov 2024 14:55:12 +0000 Subject: [PATCH 1/2] xauth: Decrease min magic cookie length to 40 This is causing issues on Tumbleweed distrobox in WSL, where the cookie being generated is 49 chars long. Signed-off-by: Paulo Gomes --- internal/util/xauth/xauth.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/util/xauth/xauth.go b/internal/util/xauth/xauth.go index 2cd4019..8b386c3 100644 --- a/internal/util/xauth/xauth.go +++ b/internal/util/xauth/xauth.go @@ -16,13 +16,13 @@ import ( var cookieFunc = newCookie func AuthPair(display uint8, parent io.Reader, server, client io.Writer) error { - data := make([]byte, 50) + data := make([]byte, 40) n, err := parent.Read(data) if err != nil { return fmt.Errorf("failed to read from parent auth file: %w", err) } - if n < 50 { - return fmt.Errorf("auth file must be at least 50 chars long: was %d instead", n) + if n < 40 { + return fmt.Errorf("auth file must be at least 40 chars long: was %d instead", n) } _, _ = server.Write(data[0:2]) From dfe86f50a72cff6a3d36796fc57deb8252a7a49f Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Tue, 26 Nov 2024 14:56:23 +0000 Subject: [PATCH 2/2] WSL: Eval symlink to .X11-unix dir Signed-off-by: Paulo Gomes --- internal/profiles/profiles.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/profiles/profiles.go b/internal/profiles/profiles.go index 8449c57..880bcea 100644 --- a/internal/profiles/profiles.go +++ b/internal/profiles/profiles.go @@ -433,10 +433,20 @@ func createNewDisplay(bin string, profile *types.Profile, display string) error break } + x11Dir := "/tmp/.X11-unix" + if os.Getenv("WSL_DISTRO_NAME") != "" { + fmt.Println("\033[33mWARN: Running qubesome in WSL is experimental. Some features may not work as expected.\033[0m") + fp, err := filepath.EvalSymlinks(x11Dir) + if err != nil { + return fmt.Errorf("failed to eval symlink: %w", err) + } + x11Dir = fp + } + //nolint var paths []string paths = append(paths, "-v=/etc/localtime:/etc/localtime:ro") - paths = append(paths, "-v=/tmp/.X11-unix:/tmp/.X11-unix:rw") + paths = append(paths, fmt.Sprintf("-v=%s:/tmp/.X11-unix:rw", x11Dir)) paths = append(paths, fmt.Sprintf("-v=%s:/tmp/qube.sock:ro", socket)) paths = append(paths, fmt.Sprintf("-v=%s:/home/xorg-user/.Xserver", server)) paths = append(paths, fmt.Sprintf("-v=%s:/home/xorg-user/.Xauthority", workload))