From b156deb30beebad0d29ce7f9a2d36b2651ca0ef7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 09:57:20 +0000 Subject: import spice-vdagent-0.14.0-18.el7 --- diff --git a/SOURCES/0030-systemd-Remove-unneded-virtio-port-dependencies.patch b/SOURCES/0030-systemd-Remove-unneded-virtio-port-dependencies.patch new file mode 100644 index 0000000..b824a5c --- /dev/null +++ b/SOURCES/0030-systemd-Remove-unneded-virtio-port-dependencies.patch @@ -0,0 +1,43 @@ +From f3f132795fbbcbd890e30d98d1d3cfe2f7870347 Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Tue, 18 Dec 2018 13:46:01 +0100 +Subject: [PATCH] systemd: Remove unneded virtio-port dependencies + +The udev rule already adds SYSTEMD_WANTS=spice-vdagentd.socket +to the relevant virtio devices, which automatically adds Wants=${device} +to spice-vdagentd.socket (see 'systemctl show spice-vdagentd.socket'). +Adding a Requisite/After for these ports is at best redundant, and most +likely wrong as this is causing boot time warnings: + +[ INFO ] dev-virtio\x2dports-com.redhat.spice.0.device is not active. +[DEPEND] Dependency failed for Activation socket for spice guest agent daemon. + +https://bugzilla.redhat.com/show_bug.cgi?id=1545212 + +Signed-off-by: Christophe Fergeau +(cherry picked from commit b07420eea0aaba1b9a375eac03c1dbb565287f11) + +Note: +- Conflict due not having commit below. As this patch removes that, + not worth to backport it. + + 102b2e7 systemd: use "After" with "Requisite" +--- + data/spice-vdagentd.socket | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/data/spice-vdagentd.socket b/data/spice-vdagentd.socket +index e34a188..f14e662 100644 +--- a/data/spice-vdagentd.socket ++++ b/data/spice-vdagentd.socket +@@ -1,7 +1,5 @@ + [Unit] + Description=Activation socket for spice guest agent daemon +-# only start the socket if the virtio port device exists +-Requisite=dev-virtio\x2dports-com.redhat.spice.0.device + + [Socket] + ListenStream=/var/run/spice-vdagentd/spice-vdagent-sock +-- +2.20.1 + diff --git a/SOURCES/0031-systemd-Remove-WantedBy-sockets.service-in-Install.patch b/SOURCES/0031-systemd-Remove-WantedBy-sockets.service-in-Install.patch new file mode 100644 index 0000000..d68ba74 --- /dev/null +++ b/SOURCES/0031-systemd-Remove-WantedBy-sockets.service-in-Install.patch @@ -0,0 +1,36 @@ +From be443adb0f0f22025dbbfba15189a186dbc7cdc3 Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Wed, 19 Dec 2018 15:28:31 +0100 +Subject: [PATCH] systemd: Remove WantedBy=sockets.service in [Install] + +.socket systemd units already automatically get a +Before=sockets.service, and the udev rule we have will ensure that when +the appropriate virtio device is there, the socket unit will be started, +so this WantedBy dependency is not needed, and is in part responsible +for these warnings: + +[ INFO ] dev-virtio\x2dports-com.redhat.spice.0.device is not active. +[DEPEND] Dependency failed for Activation socket for spice guest agent daemon. + +https://bugzilla.redhat.com/show_bug.cgi?id=1545212 + +Signed-off-by: Christophe Fergeau +(cherry picked from commit 56d50d21223e6d9aec4a68400d8e36c5953ba3cc) +--- + data/spice-vdagentd.socket | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/data/spice-vdagentd.socket b/data/spice-vdagentd.socket +index f14e662..adace91 100644 +--- a/data/spice-vdagentd.socket ++++ b/data/spice-vdagentd.socket +@@ -3,6 +3,3 @@ Description=Activation socket for spice guest agent daemon + + [Socket] + ListenStream=/var/run/spice-vdagentd/spice-vdagent-sock +- +-[Install] +-WantedBy=sockets.target +-- +2.20.1 + diff --git a/SOURCES/0032-systemd-Update-path-in-unit-file.patch b/SOURCES/0032-systemd-Update-path-in-unit-file.patch new file mode 100644 index 0000000..c598ec1 --- /dev/null +++ b/SOURCES/0032-systemd-Update-path-in-unit-file.patch @@ -0,0 +1,41 @@ +From b69bd2346b92f48546eb7824ead9688fb3f7af77 Mon Sep 17 00:00:00 2001 +From: Christian Hesse +Date: Mon, 14 Jan 2019 12:12:00 +0100 +Subject: [PATCH] systemd: Update path in unit file +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When loading the unit file, systemd 240 logs: + +systemd[1]: /usr/lib/systemd/system/spice-vdagentd.service:9: PIDFile= +references path below legacy directory /var/run/, updating +/var/run/spice-vdagentd/spice-vdagentd.pid → +/run/spice-vdagentd/spice-vdagentd.pid; please update the unit file +accordingly. + +So update the path. + +Signed-off-by: Christian Hesse +Acked-by: Frediano Ziglio +(cherry picked from commit 098268a33c7c8008ccec9050aea8f0763f1c06d5) +--- + data/spice-vdagentd.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/spice-vdagentd.service b/data/spice-vdagentd.service +index 365b2c1..9c70b30 100644 +--- a/data/spice-vdagentd.service ++++ b/data/spice-vdagentd.service +@@ -7,7 +7,7 @@ Requires=spice-vdagentd.socket + Type=forking + EnvironmentFile=-/etc/sysconfig/spice-vdagentd + ExecStart=/usr/sbin/spice-vdagentd $SPICE_VDAGENTD_EXTRA_ARGS +-PIDFile=/var/run/spice-vdagentd/spice-vdagentd.pid ++PIDFile=/run/spice-vdagentd/spice-vdagentd.pid + PrivateTmp=true + Restart=on-failure + +-- +2.20.1 + diff --git a/SOURCES/0033-udscs-Avoid-file-descriptor-leak.patch b/SOURCES/0033-udscs-Avoid-file-descriptor-leak.patch new file mode 100644 index 0000000..0c0c0a9 --- /dev/null +++ b/SOURCES/0033-udscs-Avoid-file-descriptor-leak.patch @@ -0,0 +1,34 @@ +From 0fa0ce0acdddc5e517bf06df9da33c9cda6d600e Mon Sep 17 00:00:00 2001 +From: Frediano Ziglio +Date: Thu, 15 Nov 2018 21:55:11 +0000 +Subject: [PATCH] udscs: Avoid file descriptor leak + +If connection fails the socket descriptor is not closed causing +a leak. + +Signed-off-by: Frediano Ziglio +Acked-by: Victor Toso +(cherry picked from commit 2d6d0d2acd3248e981361c2f3d8b253da8f04048) + +Note: +- Conflict due g_free() usage upstream while downstream we have free() + being used. +--- + src/udscs.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/udscs.c b/src/udscs.c +index f04a31c..96a9f61 100644 +--- a/src/udscs.c ++++ b/src/udscs.c +@@ -192,6 +192,7 @@ struct udscs_connection *udscs_connect(const char *socketname, + if (conn->debug) { + syslog(LOG_DEBUG, "connect %s: %m", socketname); + } ++ close(conn->fd); + free(conn); + return NULL; + } +-- +2.20.1 + diff --git a/SOURCES/0034-x11-invalidate-requests-for-targets-on-grab-from-cli.patch b/SOURCES/0034-x11-invalidate-requests-for-targets-on-grab-from-cli.patch new file mode 100644 index 0000000..44ef0f1 --- /dev/null +++ b/SOURCES/0034-x11-invalidate-requests-for-targets-on-grab-from-cli.patch @@ -0,0 +1,72 @@ +From 3ff64705a7802e4944fcb5e7a027126127043bc8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20Jank=C5=AF?= +Date: Thu, 21 Feb 2019 21:25:57 +0100 +Subject: [PATCH] x11: invalidate requests for targets on grab from client +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If XSetSelectionOwner() is invoked during the time +we are waiting for the requested clipboard targets, +the targets we eventually receive are no longer valid. + +To solve this, ignore the same count of target notifications +as we expected at the time we received grab from the client. + +Otherwise we end up in a situation when vdagent holds +the clipboard grab in the guest but cannot provide data to the +apps that request it - this can be observed in the log: + + clipboard: received selection request event for target *, while not owning client clipboard + +Signed-off-by: Jakub Janků +Acked-by: Victor Toso +--- + src/vdagent-x11-priv.h | 1 + + src/vdagent-x11.c | 11 +++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h +index 38f852e..29018a3 100644 +--- a/src/vdagent-x11-priv.h ++++ b/src/vdagent-x11-priv.h +@@ -97,6 +97,7 @@ struct vdagent_x11 { + int xfixes_event_base; + int max_prop_size; + int expected_targets_notifies[256]; ++ int ignore_targets_notifies[256]; + int clipboard_owner[256]; + int clipboard_type_count[256]; + uint32_t clipboard_agent_types[256][256]; +diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c +index 5ac2cf7..3d752c1 100644 +--- a/src/vdagent-x11.c ++++ b/src/vdagent-x11.c +@@ -894,6 +894,12 @@ static void vdagent_x11_handle_targets_notify(struct vdagent_x11 *x11, + + x11->expected_targets_notifies[selection]--; + ++ if (x11->ignore_targets_notifies[selection] > 0) { ++ x11->ignore_targets_notifies[selection]--; ++ VSELPRINTF("ignoring selection notify TARGETS"); ++ return; ++ } ++ + /* If we have more targets_notifies pending, ignore this one, we + are only interested in the targets list of the current owner + (which is the last one we've requested a targets list from) */ +@@ -1194,6 +1200,11 @@ void vdagent_x11_clipboard_grab(struct vdagent_x11 *x11, uint8_t selection, + x11->selection_window, CurrentTime); + vdagent_x11_set_clipboard_owner(x11, selection, owner_client); + ++ /* If there're pending requests for targets, ignore the returned ++ * targets as the XSetSelectionOwner() call above made them invalid */ ++ x11->ignore_targets_notifies[selection] = ++ x11->expected_targets_notifies[selection]; ++ + /* Flush output buffers and consume any pending events */ + vdagent_x11_do_read(x11); + } +-- +2.20.1 + diff --git a/SOURCES/0035-vdagent_x11_target_to_type-Improve-error-logging.patch b/SOURCES/0035-vdagent_x11_target_to_type-Improve-error-logging.patch new file mode 100644 index 0000000..f22aeaa --- /dev/null +++ b/SOURCES/0035-vdagent_x11_target_to_type-Improve-error-logging.patch @@ -0,0 +1,35 @@ +From 291e3fe366197c3958d3bb13486bee786a362d48 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 8 Aug 2013 12:01:48 +0200 +Subject: [PATCH 35/36] vdagent_x11_target_to_type: Improve error logging + +Signed-off-by: Hans de Goede +(cherry picked from commit bad87034bbed85e65e9b8fe479c967a3d0f9c861) +--- + src/vdagent-x11.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c +index 3d752c1..e72fd24 100644 +--- a/src/vdagent-x11.c ++++ b/src/vdagent-x11.c +@@ -833,6 +833,8 @@ static void vdagent_x11_handle_selection_notify(struct vdagent_x11 *x11, + selection = x11->conversion_req->selection; + type = vdagent_x11_target_to_type(x11, selection, + x11->conversion_req->target); ++ if (type == VD_AGENT_CLIPBOARD_NONE) ++ syslog(LOG_ERR, "internal error conversion_req has bad target"); + if (len == 0) { /* No errors so far */ + len = vdagent_x11_get_selection(x11, event, selection, + x11->conversion_req->target, +@@ -1062,6 +1064,7 @@ static void vdagent_x11_handle_selection_request(struct vdagent_x11 *x11) + type = vdagent_x11_target_to_type(x11, selection, + event->xselectionrequest.target); + if (type == VD_AGENT_CLIPBOARD_NONE) { ++ syslog(LOG_ERR, "guest app requested a non-advertised target"); + vdagent_x11_send_selection_notify(x11, None, NULL); + return; + } +-- +2.20.1 + diff --git a/SOURCES/0036-vdagent-x11-Turn-some-error-messages-into-debugging-.patch b/SOURCES/0036-vdagent-x11-Turn-some-error-messages-into-debugging-.patch new file mode 100644 index 0000000..9290deb --- /dev/null +++ b/SOURCES/0036-vdagent-x11-Turn-some-error-messages-into-debugging-.patch @@ -0,0 +1,62 @@ +From 81c96df492e8f8b01640634fcd79234f63f5228e Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 13 Aug 2013 12:19:54 +0200 +Subject: [PATCH 36/36] vdagent-x11: Turn some error messages into debugging + messages (rhbz#918310) + +Some bad clients, ie autocutsel, don't stick to the icccm spec, causing us to +flood the logs with error messages, turn these into debug messages instead, +so that they are only shown when debuggging / verbose logging is turned on. + +Signed-off-by: Hans de Goede +(cherry picked from commit d39230cee236bc6b8b150c7687d49a46f519bd2b) +--- + src/vdagent-x11.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c +index e72fd24..c925b43 100644 +--- a/src/vdagent-x11.c ++++ b/src/vdagent-x11.c +@@ -761,8 +761,8 @@ static uint32_t vdagent_x11_target_to_type(struct vdagent_x11 *x11, + } + } + +- SELPRINTF("unexpected selection type %s", +- vdagent_x11_get_atom_name(x11, target)); ++ VSELPRINTF("unexpected selection type %s", ++ vdagent_x11_get_atom_name(x11, target)); + return VD_AGENT_CLIPBOARD_NONE; + } + +@@ -834,7 +834,8 @@ static void vdagent_x11_handle_selection_notify(struct vdagent_x11 *x11, + type = vdagent_x11_target_to_type(x11, selection, + x11->conversion_req->target); + if (type == VD_AGENT_CLIPBOARD_NONE) +- syslog(LOG_ERR, "internal error conversion_req has bad target"); ++ SELPRINTF("internal error conversion_req has bad target %s", ++ vdagent_x11_get_atom_name(x11, x11->conversion_req->target)); + if (len == 0) { /* No errors so far */ + len = vdagent_x11_get_selection(x11, event, selection, + x11->conversion_req->target, +@@ -1064,7 +1065,7 @@ static void vdagent_x11_handle_selection_request(struct vdagent_x11 *x11) + type = vdagent_x11_target_to_type(x11, selection, + event->xselectionrequest.target); + if (type == VD_AGENT_CLIPBOARD_NONE) { +- syslog(LOG_ERR, "guest app requested a non-advertised target"); ++ VSELPRINTF("guest app requested a non-advertised target"); + vdagent_x11_send_selection_notify(x11, None, NULL); + return; + } +@@ -1310,7 +1311,7 @@ void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection) + } + + if (x11->clipboard_owner[selection] != owner_client) { +- SELPRINTF("received release while not owning client clipboard"); ++ VSELPRINTF("received release while not owning client clipboard"); + return; + } + +-- +2.20.1 + diff --git a/SPECS/spice-vdagent.spec b/SPECS/spice-vdagent.spec index 9e4631b..3cb11dd 100644 --- a/SPECS/spice-vdagent.spec +++ b/SPECS/spice-vdagent.spec @@ -1,6 +1,6 @@ Name: spice-vdagent Version: 0.14.0 -Release: 16%{?dist} +Release: 18%{?dist} Summary: Agent for Spice guests Group: Applications/System License: GPLv3+ @@ -39,6 +39,15 @@ Patch26: 0026-session-info-check-if-session-belongs-to-user.patch Patch27: 0027-systemd-login-check-for-LockedHint-property.patch Patch28: 0028-Add-systemd-socket-activation.patch Patch29: 0029-spice-vdagent.desktop-Change-autostart-to-WindowMana.patch +Patch30: 0030-systemd-Remove-unneded-virtio-port-dependencies.patch +Patch31: 0031-systemd-Remove-WantedBy-sockets.service-in-Install.patch +Patch32: 0032-systemd-Update-path-in-unit-file.patch +Patch33: 0033-udscs-Avoid-file-descriptor-leak.patch +Patch34: 0034-x11-invalidate-requests-for-targets-on-grab-from-cli.patch +Patch35: 0035-vdagent_x11_target_to_type-Improve-error-logging.patch +Patch36: 0036-vdagent-x11-Turn-some-error-messages-into-debugging-.patch + + BuildRequires: systemd-devel glib2-devel spice-protocol >= 0.12.6 BuildRequires: libpciaccess-devel libXrandr-devel libXinerama-devel BuildRequires: libXfixes-devel systemd-units desktop-file-utils libtool @@ -91,6 +100,13 @@ Features: %patch27 -p1 %patch28 -p1 %patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 autoreconf -fi @@ -132,6 +148,18 @@ rm $RPM_BUILD_ROOT%{_sysconfdir}/modules-load.d/spice-vdagentd.conf %changelog +* Mon Apr 8 2019 Victor Toso - 0.14.0-18 +- Fix clipboard logs on requests for targets on grab from client + Resolves: rhbz#1594876 +- Make some clipboard logs debug instead of error + Resolves: rhbz#1686008 + +* Fri Mar 15 2019 Victor Toso - 0.14.0-17 +- Fix 'Dependency failed for Activation socket' message + Resolves: rhbz#1545212 +- Fix socket leak + Resolves: rhbz#1650596 + * Fri Sep 7 2018 Victor Toso - 0.14.0-16 - Change session agent initialization stage to WindowManager Resolves: rhbz#1623947