Hello community,

here is the log from the commit of package virt-viewer for openSUSE:Leap:15.2 
checked in at 2020-03-13 10:59:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/virt-viewer (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.virt-viewer.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "virt-viewer"

Fri Mar 13 10:59:26 2020 rev:14 rq:784269 version:8.0

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/virt-viewer/virt-viewer.changes        
2020-01-15 16:28:11.616745680 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.virt-viewer.new.3160/virt-viewer.changes      
2020-03-13 11:01:35.416615000 +0100
@@ -1,0 +2,16 @@
+Tue Mar 10 14:06:56 MDT 2020 - [email protected]
+
+- bsc#1166288 - Enable vte in remote-viewer build to support
+  multiple spice displays (eg: qemu-kvm -display spice-app)
+  virt-viewer.spec
+
+-------------------------------------------------------------------
+Mon Mar  9 15:10:19 MDT 2020 - [email protected]
+
+- Upstream bug fixes (bsc#1166289)
+  c2dabf07-Fix-a-regression-when-initial-connection-fails.patch
+  a13173ae-remote-viewer-fix-free-on-dangling-pointer.patch
+  a724dff8-remote-viewer-add-handler-for-SIGINT-signal.patch
+  e4bacb8f-remote-viewer-add-a-default-extension-to-screenshot-filenames.patch
+
+-------------------------------------------------------------------

New:
----
  a13173ae-remote-viewer-fix-free-on-dangling-pointer.patch
  a724dff8-remote-viewer-add-handler-for-SIGINT-signal.patch
  c2dabf07-Fix-a-regression-when-initial-connection-fails.patch
  e4bacb8f-remote-viewer-add-a-default-extension-to-screenshot-filenames.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ virt-viewer.spec ++++++
--- /var/tmp/diff_new_pack.4jZQxA/_old  2020-03-13 11:01:36.052615454 +0100
+++ /var/tmp/diff_new_pack.4jZQxA/_new  2020-03-13 11:01:36.056615457 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package virt-viewer
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,8 +16,6 @@
 #
 
 
-%define gtk_arg --with-gtk=3.0
-
 Name:           virt-viewer
 Summary:        Virtual Machine Viewer
 License:        GPL-2.0-or-later
@@ -26,6 +24,10 @@
 Release:        0
 Url:            http://www.virt-manager.org
 Source:         
https://virt-manager.org/download/sources/virt-viewer/%name-%version.tar.gz
+Patch1:         c2dabf07-Fix-a-regression-when-initial-connection-fails.patch
+Patch2:         a13173ae-remote-viewer-fix-free-on-dangling-pointer.patch
+Patch3:         a724dff8-remote-viewer-add-handler-for-SIGINT-signal.patch
+Patch4:         
e4bacb8f-remote-viewer-add-a-default-extension-to-screenshot-filenames.patch
 Patch50:        netcat.patch
 Patch51:        virtview-desktop.patch
 Patch52:        virtview-dont-show-Domain-0.patch
@@ -38,6 +40,7 @@
 BuildRequires:  libpixman-1-0-devel
 BuildRequires:  libxml2-devel
 BuildRequires:  spice-gtk-devel
+BuildRequires:  vte-devel
 BuildRequires:  pkgconfig(gtk+-3.0)
 BuildRequires:  pkgconfig(gtk-vnc-2.0)
 BuildRequires:  pkgconfig(libvirt) >= 0.10.0
@@ -52,12 +55,16 @@
 
 %prep
 %setup -q
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 %patch50 -p1
 %patch51 -p1
 %patch52 -p1
 
 %build
-%configure --with-spice-gtk %{gtk_arg} --disable-update-mimedb
+%configure --with-spice-gtk --disable-update-mimedb
 make %{?_smp_mflags}
 
 %install

++++++ a13173ae-remote-viewer-fix-free-on-dangling-pointer.patch ++++++
Subject: remote-viewer: fix free on dangling pointer
From: Victor Toso [email protected] Fri Sep 27 15:20:29 2019 +0200
Date: Fri Oct 4 10:02:42 2019 +0200:
Git: a13173ae649412d06106a0d9c6d29e6a45d5bf57

On remote_viewer_session_connected() we are passing a dup of URI of
connection and freeing it afterwards. Problem is, we don't disconnect
from listening "session-connected" and on an eventual second emission
of this signal, remote-viewer crashes as seen in the backtrace below.

This can happen over switch-host migration message from
SpiceMainChannel.

A fix trying to use VirtViewerApp URI avoid the crash but introduces
regression while running remote-viewer with ovirt so, keeping the
changes to a minimum to avoid it, just use g_intern_string() for now.

Found it while improving migrate.py from spice/tests (server):
 | Invalid free() / delete / delete[] / realloc()
 |    at 0x4839A0C: free (vg_replace_malloc.c:540)
 |    by 0x56EBD8C: g_free (in /usr/lib64/libglib-2.0.so.0.6000.6)
 |    by 0x11DED0: remote_viewer_session_connected (remote-viewer.c:658)
 |    by 0x564D741: g_closure_invoke (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x56614F3: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566A34D: g_signal_emit_valist (in 
/usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566AF68: g_signal_emit_by_name (in 
/usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x135E5D: virt_viewer_session_spice_main_channel_event 
(virt-viewer-session-spice.c:699)
 |    by 0x564D741: g_closure_invoke (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x56614F3: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566A34D: g_signal_emit_valist (in 
/usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x53149E3: emit_main_context (gio-coroutine.c:198)
 |  Address 0x18f1ecc0 is 0 bytes inside a block of size 23 free'd
 |    at 0x4839A0C: free (vg_replace_malloc.c:540)
 |    by 0x56EBD8C: g_free (in /usr/lib64/libglib-2.0.so.0.6000.6)
 |    by 0x11DED0: remote_viewer_session_connected (remote-viewer.c:658)
 |    by 0x564D741: g_closure_invoke (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x56614F3: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566A34D: g_signal_emit_valist (in 
/usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566AF68: g_signal_emit_by_name (in 
/usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x135E5D: virt_viewer_session_spice_main_channel_event 
(virt-viewer-session-spice.c:699)
 |    by 0x564D741: g_closure_invoke (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x56614F3: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566A34D: g_signal_emit_valist (in 
/usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x53149E3: emit_main_context (gio-coroutine.c:198)
 |  Block was alloc'd at
 |    at 0x483880B: malloc (vg_replace_malloc.c:309)
 |    by 0x56EBC98: g_malloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
 |    by 0x5705C43: g_strdup (in /usr/lib64/libglib-2.0.so.0.6000.6)
 |    by 0x11EB80: remote_viewer_initial_connect (remote-viewer.c:696)
 |    by 0x11EB80: remote_viewer_start (remote-viewer.c:790)
 |    by 0x1250D3: virt_viewer_app_start (virt-viewer-app.c:1727)
 |    by 0x127108: virt_viewer_app_on_application_startup 
(virt-viewer-app.c:1870)
 |    by 0x564D741: g_closure_invoke (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x5661638: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566A34D: g_signal_emit_valist (in 
/usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x566A972: g_signal_emit (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 |    by 0x553ECA1: g_application_register (in 
/usr/lib64/libgio-2.0.so.0.6000.6)
 |    by 0x553F41D: g_application_run (in /usr/lib64/libgio-2.0.so.0.6000.6)

Signed-off-by: Victor Toso <[email protected]>
Acked-by: Eduardo Lima (Etrunko) <[email protected]>

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 8938ef9..8eaa72e 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -645,17 +645,13 @@ remote_viewer_recent_add(gchar *uri, const gchar 
*mime_type)
 
 static void
 remote_viewer_session_connected(VirtViewerSession *session,
-                                gchar *guri)
+                                const gchar *guri)
 {
     gchar *uri = virt_viewer_session_get_uri(session);
     const gchar *mime = virt_viewer_session_mime_type(session);
 
-    if (uri == NULL)
-        uri = g_strdup(guri);
-
-    remote_viewer_recent_add(uri, mime);
+    remote_viewer_recent_add(uri != NULL ? uri : (char *) guri, mime);
     g_free(uri);
-    g_free(guri);
 }
 
 static gchar *
@@ -694,7 +690,7 @@ remote_viewer_initial_connect(RemoteViewer *self, const 
gchar *type, const gchar
     }
 
     g_signal_connect(virt_viewer_app_get_session(app), "session-connected",
-                     G_CALLBACK(remote_viewer_session_connected), 
g_strdup(guri));
+                     G_CALLBACK(remote_viewer_session_connected), (gpointer) 
g_intern_string(guri));
 
     virt_viewer_session_set_file(virt_viewer_app_get_session(app), vvfile);
 #ifdef HAVE_OVIRT
++++++ a724dff8-remote-viewer-add-handler-for-SIGINT-signal.patch ++++++
Subject: remote-viewer: add handler for SIGINT signal
From: Francesco Giudici [email protected] Fri Jan 17 16:06:13 2020 +0100
Date: Fri Jan 17 16:37:52 2020 +0000:
Git: a724dff8a3ba6d5e8d3baf79b0041b1b73bd190d

When remote-viewer is started from terminal, CTRL-C sends a SIGINT
signal to the program causing immediate termination. On linux clients
usb redirected devices are left without any kernel driver attached,
causing them to appear as no more available to the host.
Add a SIGINT handler to allow a clean exit, in particular to allow
the kernel to attach back the host driver.
The issue is present on linux only.

To perform usb device redirection, virt-viewer leverages spice-gtk
library, which in turn relies on usbredir library, which uses libusb.
In order to take control of the usb device the auto-loaded kernel
driver must be detached. This is achieved (in the very end) with
libusb_detach_kernel_driver(). Then the device interfaces can be claimed
with libusb_claim_interface() and get in control to the application.
During normal application termination, the usb channel is teared down,
performing a reset of the usb device and giving back the control of the
device to the kernel (libusb_attach_kernel_driver()).
If the application quits without doing this, the device interfaces will
end up with no driver attached, making them not usable in the host
system.

Note that enabling libusb_set_auto_detach_kernel_driver() does not solve
the issue, as this is just a convenient API from libusb: libusb will
take care of detaching/attaching the driver to the interfaces of the usb
device each time a call to libusb_release_interface() and
libusb_claim_interface() is performed. An unexpected quit of the
application will skip the libusb_release_interface() call too, leaving
the interfaces without any driver attached.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1713311

Reviewed-by: Daniel P. BerrangĂ© <[email protected]>
Signed-off-by: Francesco Giudici <[email protected]>

Index: virt-viewer-8.0/src/virt-viewer-app.c
===================================================================
--- virt-viewer-8.0.orig/src/virt-viewer-app.c
+++ virt-viewer-8.0/src/virt-viewer-app.c
@@ -37,6 +37,10 @@
 #include <glib/gi18n.h>
 #include <errno.h>
 
+#ifndef G_OS_WIN32
+#include <glib-unix.h>
+#endif
+
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -1737,6 +1741,23 @@ static gboolean opt_fullscreen = FALSE;
 static gboolean opt_kiosk = FALSE;
 static gboolean opt_kiosk_quit = FALSE;
 
+#ifndef G_OS_WIN32
+static gboolean
+sigint_cb(gpointer data)
+{
+    VirtViewerApp *self = VIRT_VIEWER_APP(data);
+    VirtViewerAppPrivate *priv = self->priv;
+
+    g_debug("got SIGINT, quitting\n");
+    if (priv->started)
+        virt_viewer_app_quit(self);
+    else
+        exit(EXIT_SUCCESS);
+
+    return G_SOURCE_CONTINUE;
+}
+#endif
+
 static void
 title_maybe_changed(VirtViewerApp *self, GParamSpec* pspec G_GNUC_UNUSED, 
gpointer user_data G_GNUC_UNUSED)
 {
@@ -1751,6 +1772,10 @@ virt_viewer_app_init(VirtViewerApp *self
 
     gtk_window_set_default_icon_name("virt-viewer");
 
+#ifndef G_OS_WIN32
+    g_unix_signal_add (SIGINT, sigint_cb, self);
+#endif
+
     self->priv->displays = g_hash_table_new_full(g_direct_hash, 
g_direct_equal, NULL, g_object_unref);
     self->priv->config = g_key_file_new();
     self->priv->config_file = g_build_filename(g_get_user_config_dir(),
++++++ c2dabf07-Fix-a-regression-when-initial-connection-fails.patch ++++++
Subject: Fix a regression when initial connection fails
From: Jonathon Jongsma [email protected] Tue Jan 29 14:47:51 2019 -0600
Date: Tue Apr 16 15:19:51 2019 -0500:
Git: c2dabf0730e1601745d2cdfc28f59e65e17cdab1

Due to changes in commit 65ef66e4, when the initial connection fails,
virt-viewer just sat quietly and didn't indicate what was wrong. It also
did not exit as it did before.  This is because we were using
virt_viewer_session_spice_channel_destroy() incorrectly. This function
was intended to be a callback that is called to clean up the VV session
when the SpiceSession tells us that a channel has been destroyed. It
does not actually destroy the channel, it only cleans up references to
that channel within virt-viewer. After calling this function, the
channel is not affected in any way. If the channel object was valid
before calling the function, it will be valid and unchanged after
calling the function as well.

The problem is that before commit 65ef66e4, this function
(_channel_destroy()) also had a side-effect of emitting a signal that
made us think that the SpiceSession was disconnected when it was not.
The application responded to this signal by exiting even though the
session was not properly disconnected and cleaned up.

We now no longer exit the application until the SpiceSession is properly
disconnected and cleaned up. So we need to make sure that this happens
when our initial connection fails. Therefore, when the main channel
receives an error channel-event, we should not call
virt_viewer_session_spice_channel_destroy(). This function should only
be called when a channel has actually been destroyed, and the channel is
not destroyed at this point.  We should instead explicitly disconnect
the session, which will result in the channels being destroyed properly.
After the session destroys all of the channels, the 'channel-destroy' signal
will be emitted by SpiceSession, so the _channel_destroy() function will
eventually get called by the signal handler.

To make the proper use of the function more obvious, I also changed the
function name from _channel_destroy() to _channel_destroyed() and added
a comment.

Fixes: rhbz#1666869
Signed-off-by: Jonathon Jongsma <[email protected]>
Acked-by: Christophe Fergeau <[email protected]>

Index: virt-viewer-8.0/src/virt-viewer-session-spice.c
===================================================================
--- virt-viewer-8.0.orig/src/virt-viewer-session-spice.c
+++ virt-viewer-8.0/src/virt-viewer-session-spice.c
@@ -78,9 +78,9 @@ static void virt_viewer_session_spice_us
 static void virt_viewer_session_spice_channel_new(SpiceSession *s,
                                                   SpiceChannel *channel,
                                                   VirtViewerSession *session);
-static void virt_viewer_session_spice_channel_destroy(SpiceSession *s,
-                                                      SpiceChannel *channel,
-                                                      VirtViewerSession 
*session);
+static void virt_viewer_session_spice_channel_destroyed(SpiceSession *s,
+                                                        SpiceChannel *channel,
+                                                        VirtViewerSession 
*session);
 static void virt_viewer_session_spice_session_disconnected(SpiceSession *s,
                                                            
VirtViewerSessionSpice *session);
 static void virt_viewer_session_spice_smartcard_insert(VirtViewerSession 
*session);
@@ -406,7 +406,7 @@ create_spice_session(VirtViewerSessionSp
     virt_viewer_signal_connect_object(self->priv->session, "channel-new",
                                       
G_CALLBACK(virt_viewer_session_spice_channel_new), self, 0);
     virt_viewer_signal_connect_object(self->priv->session, "channel-destroy",
-                                      
G_CALLBACK(virt_viewer_session_spice_channel_destroy), self, 0);
+                                      
G_CALLBACK(virt_viewer_session_spice_channel_destroyed), self, 0);
     virt_viewer_signal_connect_object(self->priv->session, "disconnected",
                                       
G_CALLBACK(virt_viewer_session_spice_session_disconnected), self, 0);
 
@@ -785,14 +785,14 @@ virt_viewer_session_spice_main_channel_e
                 spice_session_connect(self->priv->session);
             }
         } else {
-            virt_viewer_session_spice_channel_destroy(NULL, channel, session);
+            spice_session_disconnect(self->priv->session);
         }
         break;
     }
     case SPICE_CHANNEL_ERROR_IO:
     case SPICE_CHANNEL_ERROR_LINK:
     case SPICE_CHANNEL_ERROR_TLS:
-        virt_viewer_session_spice_channel_destroy(NULL, channel, session);
+        spice_session_disconnect(self->priv->session);
         break;
     default:
         g_warning("unhandled spice main channel event: %u", event);
@@ -1327,10 +1327,11 @@ virt_viewer_session_spice_session_discon
     g_signal_emit_by_name(self, "session-disconnected", error ? error->message 
: NULL);
 }
 
+/* called when the spice session indicates that a session has been destroyed */
 static void
-virt_viewer_session_spice_channel_destroy(G_GNUC_UNUSED SpiceSession *s,
-                                          SpiceChannel *channel,
-                                          VirtViewerSession *session)
+virt_viewer_session_spice_channel_destroyed(G_GNUC_UNUSED SpiceSession *s,
+                                            SpiceChannel *channel,
+                                            VirtViewerSession *session)
 {
     VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(session);
     int id;
++++++ 
e4bacb8f-remote-viewer-add-a-default-extension-to-screenshot-filenames.patch 
++++++
Subject: remote-viewer: add a default extension to screenshot filenames
From: Julien ROPE [email protected] Fri Dec 13 11:16:23 2019 +0100
Date: Wed Feb 19 09:47:21 2020 +0100:
Git: e4bacb8fde16cd21b8b8f095be720ad1a6c2d0e5

When doing a screenshot, if the user provides a filename without a file
extension, an error occurs because the image format could not be determined.
This patch adds a .png extension to such filenames, so that there is a default
file format for screenshots.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1752514

Reviewed-by: Victor Toso <[email protected]>
Signed-off-by: Julien RopĂ© <[email protected]>

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 4c08423..f58ebad 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -1069,6 +1069,14 @@ virt_viewer_window_menu_file_screenshot(GtkWidget *menu 
G_GNUC_UNUSED,
         GError *error = NULL;
 
         filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
+        if (g_strrstr(filename, ".") == NULL) {
+            // no extension provided: add the .png default
+            char *tmp_filename ;
+            tmp_filename = g_strdup_printf("%s.png", filename) ;
+            g_free(filename) ;
+            filename = tmp_filename ;
+        }
+
         if (!virt_viewer_window_save_screenshot(self, filename, &error)) {
             virt_viewer_app_simple_message_dialog(self->priv->app,
                                                   error->message);
++++++ netcat.patch ++++++
--- /var/tmp/diff_new_pack.4jZQxA/_old  2020-03-13 11:01:36.100615488 +0100
+++ /var/tmp/diff_new_pack.4jZQxA/_new  2020-03-13 11:01:36.100615488 +0100
@@ -1,8 +1,8 @@
-Index: virt-viewer-6.0/src/virt-viewer-app.c
+Index: virt-viewer-8.0/src/virt-viewer-app.c
 ===================================================================
---- virt-viewer-6.0.orig/src/virt-viewer-app.c
-+++ virt-viewer-6.0/src/virt-viewer-app.c
-@@ -627,7 +627,7 @@ virt_viewer_app_open_tunnel_ssh(const ch
+--- virt-viewer-8.0.orig/src/virt-viewer-app.c
++++ virt-viewer-8.0/src/virt-viewer-app.c
+@@ -619,7 +619,7 @@ virt_viewer_app_open_tunnel_ssh(const ch
      else
          g_string_append_printf(cat, "UNIX-CONNECT:%s", unixsock);
  

++++++ virtview-dont-show-Domain-0.patch ++++++
--- /var/tmp/diff_new_pack.4jZQxA/_old  2020-03-13 11:01:36.116615499 +0100
+++ /var/tmp/diff_new_pack.4jZQxA/_new  2020-03-13 11:01:36.116615499 +0100
@@ -2,11 +2,11 @@
 A user should not be able to connect to Domain-0. Don't show it
 in the list.
 
-Index: virt-viewer-6.0/src/virt-viewer.c
+Index: virt-viewer-8.0/src/virt-viewer.c
 ===================================================================
---- virt-viewer-6.0.orig/src/virt-viewer.c
-+++ virt-viewer-6.0/src/virt-viewer.c
-@@ -827,6 +827,7 @@ choose_vm(GtkWindow *main_window,
+--- virt-viewer-8.0.orig/src/virt-viewer.c
++++ virt-viewer-8.0/src/virt-viewer.c
+@@ -823,6 +823,7 @@ choose_vm(GtkWindow *main_window,
      virDomainPtr *domains, dom = NULL;
      int i, vms_running;
      unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING;
@@ -14,7 +14,7 @@
  
      g_return_val_if_fail(vm_name != NULL, NULL);
      free(*vm_name);
-@@ -835,8 +836,11 @@ choose_vm(GtkWindow *main_window,
+@@ -831,8 +832,11 @@ choose_vm(GtkWindow *main_window,
  
      vms_running = virConnectListAllDomains(conn, &domains, flags);
      for (i = 0; i < vms_running; i++) {


Reply via email to