FS#63881 - [virt-manager] Clipboard issues with gnome/mutter 3.34 and virt-manager (spice?)

Attached to Project: Community Packages
Opened by Peet (orangecake) - Saturday, 21 September 2019, 21:47 GMT
Last edited by freswa (frederik) - Monday, 01 March 2021, 03:58 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To freswa (frederik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
After finally upgrading to gnome 3.34, I am having some issues with virt-manager and its components.

Steps to reproduce:

- Boot up a vm which uses vdagent to support sharing the clipboard with the host (through spice)
- copy a string to the clipboard (guest), paste it in an editor (in the host), this should work
- copy another string or the same one, it really doesn't matter, and paste it in an editor again, this should not work and you should experience a small noticeable freeze/stutter.
- by repeating this again, it should work and the cycle contininues

Temporary fix: Simply copy the string twice.

Additional info:
* package version(s)

Affected by this bug (3.34):

gnome-desktop 1:3.34.0-1
gnome-session 3.34.0+2+g9d8b0709-1
gnome-settings-daemon 3.34.0-1
gnome-shell 1:3.34.0+148+g506b75fc7-1
mutter 3.34.0+30+gb5775e3d8-1

Not affected by this (3.32):

gnome-desktop 1:3.32.2
gnome-session 3.32.0
gnome-settings-daemon 3.32.1
gnome-shell 1:3.32.2+11+g1c6abf378
mutter 3.32.2+43+gb7f158811

virt stuff:

virt-manager 2.2.0-2
spice 0.14.2-1
spice-gtk 0.37-1

More notes:

I have a feeling that this may have something to do with the recent changes in mutter, especially the new clipboard manager, but that is just speculation.

This task depends upon

Closed by  freswa (frederik)
Monday, 01 March 2021, 03:58 GMT
Reason for closing:  No response
Comment by Peet (orangecake) - Wednesday, 02 October 2019, 22:30 GMT
Upstream issue: https://gitlab.gnome.org/GNOME/mutter/issues/824

There are upstream patches which fixes race-conditions regarding ownership but this requires applying patches to various packages (vdagent, spice-gtk, spice-protocol). There were no patches for the win32 vdagent variant, so this was not viable for me to use, hence this simple patch which basically disables the clipboard-manager in mutter, which should restore the previous behavior, until major progress has been done upstream.

From 26b8caf24838e3d7c492a0b46329dee1290d0083 Mon Sep 17 00:00:00 2001
From: orangecake <me@orangecake>
Date: Thu, 3 Oct 2019 00:15:49 +0200
Subject: [PATCH] core: disable clipboard manager

---
src/core/display.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/core/display.c b/src/core/display.c
index 82c9cd108..5df2e8c0c 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -785,7 +785,7 @@ meta_display_open (void)
display->bell = meta_bell_new (display);

display->selection = meta_selection_new (display);
- meta_clipboard_manager_init (display);
+ // meta_clipboard_manager_init (display);

if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY)
{
@@ -1021,7 +1021,7 @@ meta_display_close (MetaDisplay *display,
g_clear_object (&display->workspace_manager);
g_clear_object (&display->sound_player);

- meta_clipboard_manager_shutdown (display);
+ // meta_clipboard_manager_shutdown (display);

g_object_unref (display);
the_display = NULL;
--
2.23.0

Comment by Cedric Bellegarde (gnumdk) - Wednesday, 16 October 2019, 15:01 GMT
Looks like a bad idea. Clipboard manager is a really cool feature from 3.34.
Comment by Lane Russell (electricOzone) - Tuesday, 29 October 2019, 19:49 GMT
In my case, the copy/paste functionality completely breaks after the first copy, until spice-vdagent is restarted.

@Peet, could you provide a little more detail on how you applied this patch? I'm happy to give it a shot to see if it's repeatable.

@Cedric, are you saying this is a bad idea from a stability standpoint, or simply feature-enablement?
Comment by Peet (orangecake) - Tuesday, 29 October 2019, 20:14 GMT
Well, this feature did not exist before 3.34, so I don't think it's a bad idea at all, unless you really need a clipboard manager, but totally breaking previous behavior is simply unacceptable (In this case however, mutter isn't the one to blame, because apparently the race-conditions exists in spice/vdagent).

@electricOzone The patch is mutter related, so you should probably rebuild the mutter package with the patch applied. I basically cloned the mutter repository and checked-out a new branch from the stable-branch and then applied the patch. You can then simply patch mutter's PKGBUILD to use your local repository and specify the according commit-hash.
Comment by Lane Russell (electricOzone) - Tuesday, 29 October 2019, 20:32 GMT
Ah, I may have oversold my technical skills. I'm not sure I feel confident rebuilding the package myself.
Comment by Peet (orangecake) - Thursday, 31 October 2019, 14:53 GMT
@electricOzone Sorry but I don't have time to access my arch but you might wanna take a look here:

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mutter-performance

It's basically mutter with extra patches, you can probably comment-out all the pick_mr patches and simply add another line:

patch -Np1 < "$srcdir/clipboard.patch" after you have also included the patch file in the sources.
Comment by Capitani Stefano (Ste74) - Monday, 18 November 2019, 18:14 GMT
Hi there, i have been patched in Manjaro mutter with this MR and all work as expected:
https://gitlab.gnome.org/GNOME/mutter/merge_requests/939#note_649176
Comment by Aeny (Aeny) - Wednesday, 18 December 2019, 13:47 GMT
This is *still* broken, extremely annoying when copy pasting in a VM as it mostly freezes the program you're trying to paste in. Any workarounds that don't involve recompiling Gnome?
Comment by JL (JeanLucJ) - Thursday, 26 December 2019, 11:06 GMT
[Edited, wrong info]
Comment by freswa (frederik) - Wednesday, 18 November 2020, 21:00 GMT
Is still still an issue?

Loading...