Fix virt-manager console not showing up, rhbz#818169
This commit is contained in:
parent
6c38ae8e41
commit
1f8780d5c1
50
0001-Fix-parsing-URI-query.patch
Normal file
50
0001-Fix-parsing-URI-query.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From da0071300e1191f26757b4cf5146418c8b1db997 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
||||
Date: Wed, 2 May 2012 14:01:16 +0200
|
||||
Subject: [PATCH spice-gtk] Fix parsing URI query
|
||||
|
||||
Do not depend on uninitialized "len" variable to set the query string.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=818169
|
||||
---
|
||||
gtk/spice-session.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
|
||||
index 959e099..b3c66ce 100644
|
||||
--- a/gtk/spice-session.c
|
||||
+++ b/gtk/spice-session.c
|
||||
@@ -249,7 +249,6 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri)
|
||||
gchar key[32], value[128];
|
||||
gchar *host = NULL, *port = NULL, *tls_port = NULL, *uri = NULL, *password = NULL;
|
||||
gchar **target_key;
|
||||
- int len;
|
||||
gchar *path = NULL;
|
||||
gchar *authority = NULL;
|
||||
gchar *query = NULL;
|
||||
@@ -277,12 +276,10 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri)
|
||||
|
||||
if (path) {
|
||||
size_t prefix = strcspn(path, URI_QUERY_START);
|
||||
- if (len)
|
||||
- query = path + prefix;
|
||||
+ query = path + prefix;
|
||||
} else {
|
||||
size_t prefix = strcspn(authority, URI_QUERY_START);
|
||||
- if (len)
|
||||
- query = authority + prefix;
|
||||
+ query = authority + prefix;
|
||||
}
|
||||
|
||||
if (query && query[0]) {
|
||||
@@ -320,6 +317,7 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri)
|
||||
}
|
||||
|
||||
while (query && query[0] != '\0') {
|
||||
+ int len;
|
||||
if (sscanf(query, "%31[-a-zA-Z0-9]=%127[^;&]%n", key, value, &len) != 2) {
|
||||
g_warning("Failed to parse URI query '%s'", query);
|
||||
goto fail;
|
||||
--
|
||||
1.7.10
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 0649b10ed5839e407984a7118c69ca8379b4a0e4 Mon Sep 17 00:00:00 2001
|
||||
From: Christophe Fergeau <cfergeau@redhat.com>
|
||||
Date: Fri, 6 Apr 2012 15:17:43 +0200
|
||||
Subject: [PATCH] Fix read_uint* macros on big-endian archs
|
||||
|
||||
---
|
||||
gtk/generated_demarshallers.c | 12 ++++++------
|
||||
gtk/generated_demarshallers1.c | 12 ++++++------
|
||||
2 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/gtk/generated_demarshallers.c b/gtk/generated_demarshallers.c
|
||||
index f34dc12..6d67551 100644
|
||||
--- a/gtk/generated_demarshallers.c
|
||||
+++ b/gtk/generated_demarshallers.c
|
||||
@@ -18,17 +18,17 @@
|
||||
#define write_int8(ptr, val) *(int8_t *)(ptr) = val
|
||||
#define read_uint8(ptr) (*((uint8_t *)(ptr)))
|
||||
#define write_uint8(ptr, val) *(uint8_t *)(ptr) = val
|
||||
-#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr)))
|
||||
+#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))))
|
||||
#define write_int16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val)
|
||||
-#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr)))
|
||||
+#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))))
|
||||
#define write_uint16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val)
|
||||
-#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr)))
|
||||
+#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))))
|
||||
#define write_int32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val)
|
||||
-#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr)))
|
||||
+#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))))
|
||||
#define write_uint32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val)
|
||||
-#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr)))
|
||||
+#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))))
|
||||
#define write_int64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val)
|
||||
-#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr)))
|
||||
+#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))))
|
||||
#define write_uint64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val)
|
||||
#else
|
||||
#define read_int8(ptr) (*((int8_t *)(ptr)))
|
||||
diff --git a/gtk/generated_demarshallers1.c b/gtk/generated_demarshallers1.c
|
||||
index 633044c..5364769 100644
|
||||
--- a/gtk/generated_demarshallers1.c
|
||||
+++ b/gtk/generated_demarshallers1.c
|
||||
@@ -18,17 +18,17 @@
|
||||
#define write_int8(ptr, val) *(int8_t *)(ptr) = val
|
||||
#define read_uint8(ptr) (*((uint8_t *)(ptr)))
|
||||
#define write_uint8(ptr, val) *(uint8_t *)(ptr) = val
|
||||
-#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr)))
|
||||
+#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))))
|
||||
#define write_int16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val)
|
||||
-#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr)))
|
||||
+#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))))
|
||||
#define write_uint16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val)
|
||||
-#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr)))
|
||||
+#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))))
|
||||
#define write_int32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val)
|
||||
-#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr)))
|
||||
+#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))))
|
||||
#define write_uint32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val)
|
||||
-#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr)))
|
||||
+#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))))
|
||||
#define write_int64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val)
|
||||
-#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr)))
|
||||
+#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))))
|
||||
#define write_uint64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val)
|
||||
#else
|
||||
#define read_int8(ptr) (*((int8_t *)(ptr)))
|
||||
--
|
||||
1.7.9.3
|
||||
|
@ -1,154 +0,0 @@
|
||||
From 434adeb05b0d8aef0d983b346bd820287db22eae Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 14 Mar 2012 09:41:19 +0100
|
||||
Subject: [PATCH spice-gtk 1/2] usbredir: Check for existing usb channels
|
||||
after libusb init
|
||||
|
||||
Currently trying to view a usbredir enabled vm from virt-manager causes
|
||||
virt-manager to crash. This crash is caused by the following happening:
|
||||
|
||||
-virt-manager sets up the session, including connecting all the channels
|
||||
-a spice-gtk internal code path calls spice_usb_device_manager_get()
|
||||
-spice_usb_device_manager_get calls channel_new on all already connected
|
||||
usb channels
|
||||
-channel_new does:
|
||||
spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel),
|
||||
self->priv->context);
|
||||
-But self->priv->context has not been set yet (so is NULL) -> segfault!
|
||||
|
||||
This patch fixes this by moving the iterating over already connected
|
||||
usb channels to after the setting of self->priv->context. Note this means
|
||||
that the channels will no longer get checked when there is no USB_REDIR
|
||||
support. That is not a problem since spice_usb_device_manager_initable_init
|
||||
will return FALSE in that case anyways.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
gtk/usb-device-manager.c | 45 +++++++++++++++++++++------------------------
|
||||
1 file changed, 21 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
|
||||
index 29e9b4c..14b60c9 100644
|
||||
--- a/gtk/usb-device-manager.c
|
||||
+++ b/gtk/usb-device-manager.c
|
||||
@@ -62,13 +62,6 @@
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
-/* Prototypes for private functions */
|
||||
-static void channel_new(SpiceSession *session, SpiceChannel *channel,
|
||||
- gpointer user_data);
|
||||
-static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
|
||||
- gpointer user_data);
|
||||
-
|
||||
-/* ------------------------------------------------------------------ */
|
||||
/* gobject glue */
|
||||
|
||||
#define SPICE_USB_DEVICE_MANAGER_GET_PRIVATE(obj) \
|
||||
@@ -109,6 +102,10 @@ struct _SpiceUsbDeviceManagerPrivate {
|
||||
};
|
||||
|
||||
#ifdef USE_USBREDIR
|
||||
+static void channel_new(SpiceSession *session, SpiceChannel *channel,
|
||||
+ gpointer user_data);
|
||||
+static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
|
||||
+ gpointer user_data);
|
||||
static void spice_usb_device_manager_uevent_cb(GUdevClient *client,
|
||||
const gchar *action,
|
||||
GUdevDevice *udevice,
|
||||
@@ -148,11 +145,11 @@ static gboolean spice_usb_device_manager_initable_init(GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **err)
|
||||
{
|
||||
- GList *list;
|
||||
- GList *it;
|
||||
SpiceUsbDeviceManager *self;
|
||||
SpiceUsbDeviceManagerPrivate *priv;
|
||||
#ifdef USE_USBREDIR
|
||||
+ GList *list;
|
||||
+ GList *it;
|
||||
int rc;
|
||||
const gchar *const subsystems[] = {"usb", NULL};
|
||||
#endif
|
||||
@@ -175,17 +172,8 @@ static gboolean spice_usb_device_manager_initable_init(GInitable *initable,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- g_signal_connect(priv->session, "channel-new",
|
||||
- G_CALLBACK(channel_new), self);
|
||||
- g_signal_connect(priv->session, "channel-destroy",
|
||||
- G_CALLBACK(channel_destroy), self);
|
||||
- list = spice_session_get_channels(priv->session);
|
||||
- for (it = g_list_first(list); it != NULL; it = g_list_next(it)) {
|
||||
- channel_new(priv->session, it->data, (gpointer*)self);
|
||||
- }
|
||||
- g_list_free(list);
|
||||
-
|
||||
#ifdef USE_USBREDIR
|
||||
+ /* Initialize libusb */
|
||||
rc = libusb_init(&priv->context);
|
||||
if (rc < 0) {
|
||||
const char *desc = spice_usbutil_libusb_strerror(rc);
|
||||
@@ -195,6 +183,18 @@ static gboolean spice_usb_device_manager_initable_init(GInitable *initable,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+ /* Start listening for usb channels connect/disconnect */
|
||||
+ g_signal_connect(priv->session, "channel-new",
|
||||
+ G_CALLBACK(channel_new), self);
|
||||
+ g_signal_connect(priv->session, "channel-destroy",
|
||||
+ G_CALLBACK(channel_destroy), self);
|
||||
+ list = spice_session_get_channels(priv->session);
|
||||
+ for (it = g_list_first(list); it != NULL; it = g_list_next(it)) {
|
||||
+ channel_new(priv->session, it->data, (gpointer*)self);
|
||||
+ }
|
||||
+ g_list_free(list);
|
||||
+
|
||||
+ /* Start listening for usb devices plug / unplug */
|
||||
priv->udev = g_udev_client_new(subsystems);
|
||||
g_signal_connect(G_OBJECT(priv->udev), "uevent",
|
||||
G_CALLBACK(spice_usb_device_manager_uevent_cb), self);
|
||||
@@ -460,10 +460,11 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
|
||||
g_type_class_add_private(klass, sizeof(SpiceUsbDeviceManagerPrivate));
|
||||
}
|
||||
|
||||
+#ifdef USE_USBREDIR
|
||||
+
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* gudev / libusb Helper functions */
|
||||
|
||||
-#ifdef USE_USBREDIR
|
||||
static gboolean spice_usb_device_manager_get_udev_bus_n_address(
|
||||
GUdevDevice *udev, int *bus, int *address)
|
||||
{
|
||||
@@ -480,7 +481,6 @@ static gboolean spice_usb_device_manager_get_udev_bus_n_address(
|
||||
|
||||
return *bus && *address;
|
||||
}
|
||||
-#endif
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* callbacks */
|
||||
@@ -491,11 +491,9 @@ static void channel_new(SpiceSession *session, SpiceChannel *channel,
|
||||
SpiceUsbDeviceManager *self = user_data;
|
||||
|
||||
if (SPICE_IS_USBREDIR_CHANNEL(channel)) {
|
||||
-#ifdef USE_USBREDIR
|
||||
spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel),
|
||||
self->priv->context);
|
||||
spice_channel_connect(channel);
|
||||
-#endif
|
||||
g_ptr_array_add(self->priv->channels, channel);
|
||||
}
|
||||
}
|
||||
@@ -509,7 +507,6 @@ static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
|
||||
g_ptr_array_remove(self->priv->channels, channel);
|
||||
}
|
||||
|
||||
-#ifdef USE_USBREDIR
|
||||
static void spice_usb_device_manager_auto_connect_cb(GObject *gobject,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
--
|
||||
1.7.9.3
|
||||
|
@ -13,13 +13,14 @@
|
||||
|
||||
Name: spice-gtk
|
||||
Version: 0.12
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: A GTK+ widget for SPICE clients
|
||||
|
||||
Group: System Environment/Libraries
|
||||
License: LGPLv2+
|
||||
URL: http://spice-space.org/page/Spice-Gtk
|
||||
Source0: http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2
|
||||
Patch1: 0001-Fix-parsing-URI-query.patch
|
||||
|
||||
BuildRequires: intltool
|
||||
BuildRequires: gtk2-devel >= 2.14
|
||||
@ -143,6 +144,10 @@ if [ -n '%{?_version_suffix}' ]; then
|
||||
mv spice-gtk-%{version}%{?_version_suffix} spice-gtk-%{version}
|
||||
fi
|
||||
|
||||
pushd spice-gtk-%{version}
|
||||
%patch1 -p1
|
||||
popd
|
||||
|
||||
%if %{with_gtk3}
|
||||
cp -a spice-gtk-%{version} spice-gtk3-%{version}
|
||||
%endif
|
||||
@ -253,6 +258,9 @@ rm -f %{buildroot}%{_libdir}/python*/site-packages/*.la
|
||||
%{_bindir}/spicy-stats
|
||||
|
||||
%changelog
|
||||
* Wed May 2 2012 Marc-André Lureau <elmarco@makai.local> - 0.12-2
|
||||
- Fix virt-manager console not showing up, rhbz#818169
|
||||
|
||||
* Tue Apr 24 2012 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.12-1
|
||||
- New upstream release 0.12
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user