From c3395a0e8307ff3dcab37169998d5155da3aacca Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 26 Jan 2022 15:52:49 +0000 Subject: [PATCH] run: Treat DISPLAY=unix:42 the same as :42 xauth and xcb both treat this as a request to use AF_UNIX. Signed-off-by: Simon McVittie --- common/flatpak-run.c | 2 +- tests/testcommon.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/flatpak-run.c b/common/flatpak-run.c index 1b640c15..08fabee9 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -232,7 +232,7 @@ flatpak_run_parse_x11_display (const char *display, while (g_ascii_isdigit (*display_nr_end)) display_nr_end++; - if (display == colon) + if (display == colon || g_str_has_prefix (display, "unix:")) { *display_nr_out = g_strndup (display_nr, display_nr_end - display_nr); *x11_socket = g_strdup_printf ("/tmp/.X11-unix/X%s", *display_nr_out); diff --git a/tests/testcommon.c b/tests/testcommon.c index dfc2c486..aecf21e0 100644 --- a/tests/testcommon.c +++ b/tests/testcommon.c @@ -1779,6 +1779,7 @@ static const DisplayTest x11_display_tests[] = { ":0", FamilyLocal, "/tmp/.X11-unix/X0", NULL, "0" }, { ":0.0", FamilyLocal, "/tmp/.X11-unix/X0", NULL, "0" }, { ":42.0", FamilyLocal, "/tmp/.X11-unix/X42", NULL, "42" }, + { "unix:42", FamilyLocal, "/tmp/.X11-unix/X42", NULL, "42" }, { "othermachine:23", FamilyWild, NULL, "othermachine", "23" }, { "bees.example.com:23", FamilyWild, NULL, "bees.example.com", "23" }, { "[::1]:0", FamilyInternet6, NULL, "::1", "0" },