[gnome-boxes/libvirt-socket-path-long-2022] flatpak: Patch libvirt to use shorter paths for the qemu process




commit e347c6befb4886134cb8007753d59f3fab1df725
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Apr 19 17:00:46 2022 +0200

    flatpak: Patch libvirt to use shorter paths for the qemu process
    
    Similarly to issue https://gitlab.gnome.org/GNOME/gnome-boxes/-/issues/267,
    now users are seeing an issue where libvirt errs
    "Failed to start QEMU binary /app/bin/qemu-system-x86_64 for probing: qemu-system-x86_64: -qmp 
unix:/sysroot/home/redactedredactedredacte/.var/app/org.gnome.Boxes/config/libvirt/qemu/lib/qmp-ZCXGK1/qmp.monitor,server=on,wait=off:
 UNIX socket path 
'/sysroot/home/redactedredactedredacte/.var/app/org.gnome.Boxes/config/libvirt/qemu/lib/qmp-ZCXGK1/qmp.monitor'
 is too long
    Path must be less than 108 bytes"
    
    Let's use XDG_RUNTIME_DIR for Flatpak builds instead of the fully blown
    $HOME/.var/app/org.gnome.Boxes/ prefix that we get.
    
    Fixes #784

 ...bvirt-init-qmp-monitor-in-xdg-runtime-dir.patch | 43 ++++++++++++++++++++++
 build-aux/flatpak/org.gnome.BoxesDevel.json        |  4 ++
 2 files changed, 47 insertions(+)
---
diff --git a/build-aux/flatpak/libvirt-init-qmp-monitor-in-xdg-runtime-dir.patch 
b/build-aux/flatpak/libvirt-init-qmp-monitor-in-xdg-runtime-dir.patch
new file mode 100644
index 00000000..e5b47828
--- /dev/null
+++ b/build-aux/flatpak/libvirt-init-qmp-monitor-in-xdg-runtime-dir.patch
@@ -0,0 +1,43 @@
+From 7c213d37b398a7d3f9dfdcf80e0c95edf94c41d3 Mon Sep 17 00:00:00 2001
+From: Felipe Borges <felipeborges gnome org>
+Date: Tue, 19 Apr 2022 16:47:43 +0200
+Subject: [PATCH] qemu: Init qmp.monitor and qmp.pid in XDG_RUNTIME_DIR
+
+See https://gitlab.gnome.org/GNOME/gnome-boxes/-/issues/784
+---
+ src/qemu/qemu_process.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
+index f110e4f3dd..04d6ffed23 100644
+--- a/src/qemu/qemu_process.c
++++ b/src/qemu/qemu_process.c
+@@ -9238,6 +9238,7 @@ static int
+ qemuProcessQMPInit(qemuProcessQMP *proc)
+ {
+     g_autofree char *template = NULL;
++    g_autofree char *monitor_path = NULL;
+ 
+     VIR_DEBUG("proc=%p, emulator=%s", proc, proc->binary);
+ 
+@@ -9258,7 +9259,7 @@ qemuProcessQMPInit(qemuProcessQMP *proc)
+     if (qemuProcessQEMULabelUniqPath(proc) < 0)
+         return -1;
+ 
+-    proc->monpath = g_strdup_printf("%s/%s", proc->uniqDir, "qmp.monitor");
++    proc->monpath = g_build_filename (g_get_user_runtime_dir (), "qmp.monitor", NULL);
+ 
+     proc->monarg = g_strdup_printf("unix:%s,server=on,wait=off", proc->monpath);
+ 
+@@ -9267,7 +9268,7 @@ qemuProcessQMPInit(qemuProcessQMP *proc)
+      * -daemonize we need QEMU to be allowed to create them, rather
+      * than libvirtd. So we're using libDir which QEMU can write to
+      */
+-    proc->pidfile = g_strdup_printf("%s/%s", proc->uniqDir, "qmp.pid");
++    proc->pidfile = g_build_filename (g_get_user_runtime_dir (), "qmp.pid", NULL);
+ 
+     return 0;
+ }
+-- 
+2.35.1
+
diff --git a/build-aux/flatpak/org.gnome.BoxesDevel.json b/build-aux/flatpak/org.gnome.BoxesDevel.json
index 27e90e70..62cd95fe 100644
--- a/build-aux/flatpak/org.gnome.BoxesDevel.json
+++ b/build-aux/flatpak/org.gnome.BoxesDevel.json
@@ -152,6 +152,10 @@
                         {
                             "type": "patch",
                             "path": "libvirt-use-monitor-in-xdg-runtime-dir.patch"
+                        },
+                        {
+                            "type" : "patch",
+                            "path": "libvirt-init-qmp-monitor-in-xdg-runtime-dir.patch"
                         }
                     ]
                 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]