bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 59 forks source link

`wl-copy` hangs indefinitely when ran from .desktop file #168

Open Silejonu opened 1 year ago

Silejonu commented 1 year ago

wl-clipboard version: 2.1.0
OS: Arch Linux & Fedora 37
DE: GNOME 43

Running wl-copy from the command-line or through a script works flawlessly. Running wl-copy from a .desktop file hangs indefinitely.
This bug started happening a few days ago. I think I had a Mutter update recently, so this may be related. I am certain it was working previously on the same systems since I use wl-copy inside a homemade script I run regularly.

Steps to reproduce:

  1. Create the file /usr/share/applications/wl-copy_debug.desktop
    [Desktop Entry]
    Type=Application
    Encoding=UTF-8
    Name=wl-copy_debug
    Comment=wl-copy debug .desktop file
    Exec=/usr/local/bin/wl-copy_debug.sh
    Terminal=true
  2. Create the file /usr/local/bin/wl-copy_debug.sh
    
    #!/usr/bin/bash

echo 'Text from wl-copy_debug.sh' | wl-copy


3. Run the program "wl-copy_debug".
4. A terminal opens, but nothing happens. Nothing related to `wl-clipboard` shows up in `journalctl` either.
5. Run `/usr/local/bin/wl-copy_debug.sh` from the terminal. The text is copied as expected.
6. Run `echo 'Text from the CLI' | wl-copy` from the terminal. The text is copied as expected.

The bug is **not** reproducible in Debian 11 with GNOME 3.38.5 nor Arch Linux with KDE Plasma. This makes me suspect the issue is tied to a Mutter update.  
Could this be a change in API? Or a bug in Mutter? In any case, I have no programming skills, and I am incapable of understanding the root cause. Please let me know if I can help in troubleshooting in any way.
bugaevc commented 1 year ago

Hi! I can not reproduce this, it works as expected here: "Text from wl-copy_debug.sh" appears in the clipboard.

You could try to make your script more verbose. For instance, add some logging before and after invoking wl-copy, maybe like this:

(echo Running wl-copy as PID $BASHPID && WAYLAND_DEBUG=1 exec wl-copy Text from wl-copy_debug.sh) |& logger
logger wl-copy has returned $?

Then see if anything appears in the journal. If nothing at all does, it likely doesn't even get run. If only the PID does, that likely means wl-copy is hanging, and you should be able to attach to it with GDB and see what it hangs on (in case you're not familiar with using GDB: run it like gdb -p $PID_OF_WL_COPY, then type bt for backtrace, then post the output of that here so I can analyze it). Or maybe it will output lots of Wayland communication logs, you could send me that too.

Silejonu commented 1 year ago

Running from the .desktop file, I get no output. Two processes are launched:

$ ps -ef | grep wl-copy
silejonu      15097   14922  0 09:18 pts/1    00:00:00 /usr/bin/bash /usr/local/bin/wl-copy_debug.sh
silejonu      15098   15097  0 09:18 pts/1    00:00:00 wl-copy Text from wl-copy_debug.sh

gdb -p 15097 gives this:

(gdb) bt
#0  0x00007f8867e10537 in __GI___wait4 (pid=pid@entry=-1, stat_loc=stat_loc@entry=0x7ffe3a550650, options=options@entry=0, usage=usage@entry=0x0)
    at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f8867e104fb in __GI___waitpid (pid=pid@entry=-1, stat_loc=stat_loc@entry=0x7ffe3a550650, options=options@entry=0) at waitpid.c:38
#2  0x000055f00fb48aa1 in waitchld.constprop.0 (block=block@entry=1, wpid=<optimized out>) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/jobs.c:3800
#3  0x000055f00faa80b2 in wait_for (pid=15099, flags=0) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/jobs.c:2980
#4  0x000055f00fa8c722 in execute_command_internal (command=command@entry=0x55f011374750, asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=3, pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x55f011374860)
    at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:923
#5  0x000055f00fa890b0 in execute_pipeline (command=command@entry=0x55f011374830, asynchronous=asynchronous@entry=0, pipe_in=<optimized out>, 
    pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x55f011374860) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:2648
#6  0x000055f00fa89c95 in execute_connection (fds_to_close=0x55f011374860, pipe_out=-1, pipe_in=<optimized out>, asynchronous=0, 
    command=0x55f011374830) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:2787
#7  execute_command_internal (command=command@entry=0x55f011374830, asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1, 
    pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x55f011374860) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:1052
#8  0x000055f00fa8ca02 in execute_command (command=0x55f011374830) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:417
#9  0x000055f00fa7c8ea in reader_loop () at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/eval.c:172
#10 0x000055f00fa73c9e in main (argc=2, argv=0x7ffe3a550fc8, env=0x7ffe3a550fe0) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/shell.c:843

gdb -p 15098 gives this:

(gdb) bt
#0  0x00007f96c05da1e4 in __GI___poll (fds=fds@entry=0x7fffcb5f3960, nfds=nfds@entry=1, timeout=timeout@entry=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f96c06c21d4 in poll (__timeout=-1, __nfds=1, __fds=0x7fffcb5f3960) at /usr/include/bits/poll2.h:39
#2  wl_display_poll (display=0x55c20b67f2a0, events=1) at ../src/wayland-client.c:1878
#3  wl_display_dispatch_queue (queue=<optimized out>, display=<optimized out>) at ../src/wayland-client.c:1951
#4  wl_display_dispatch_queue (display=display@entry=0x55c20b67f2a0, queue=queue@entry=0x55c20b67f370) at ../src/wayland-client.c:1924
#5  0x00007f96c06c2220 in wl_display_dispatch (display=display@entry=0x55c20b67f2a0) at ../src/wayland-client.c:2026
#6  0x000055c209e62b4a in main (argc=<optimized out>, argv=<optimized out>) at ../src/wl-copy.c:275

Running from the terminal, I get no output. The command hangs indefinitely, but the text is copied immediately in the clipboard. One process is launched:

ps -ef | grep wl-copy
silejonu      16664    1844  0 09:27 pts/0    00:00:00 wl-copy Text from wl-copy_debug.sh

gdb -p 16664 gives this:

(gdb) bt
#0  0x00007f55148cb1e4 in __GI___poll (fds=fds@entry=0x7ffd26398120, nfds=nfds@entry=1, timeout=timeout@entry=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f55149b31d4 in poll (__timeout=-1, __nfds=1, __fds=0x7ffd26398120) at /usr/include/bits/poll2.h:39
#2  wl_display_poll (display=0x55e415e152a0, events=1) at ../src/wayland-client.c:1878
#3  wl_display_dispatch_queue (queue=<optimized out>, display=<optimized out>) at ../src/wayland-client.c:1951
#4  wl_display_dispatch_queue (display=display@entry=0x55e415e152a0, queue=queue@entry=0x55e415e15370) at ../src/wayland-client.c:1924
#5  0x00007f55149b3220 in wl_display_dispatch (display=display@entry=0x55e415e152a0) at ../src/wayland-client.c:2026
#6  0x000055e414f4db4a in main (argc=<optimized out>, argv=<optimized out>) at ../src/wl-copy.c:275
bugaevc commented 1 year ago

One of your messages seems to have disappeared, but here's the interesting bit:

[3111157.837]  -> wl_shm@5.create_pool(new id wl_shm_pool@15, fd 5, 4)
[3111157.840]  -> wl_shm_pool@15.create_buffer(new id wl_buffer@16, 0, 1, 1, 4, 0)
[3111157.844]  -> wl_surface@12.attach(wl_buffer@16, 0, 0)
[3111157.846]  -> wl_surface@12.damage(0, 0, 1, 1)
[3111157.847]  -> wl_surface@12.commit()

This means it's a case of https://github.com/bugaevc/wl-clipboard/labels/cant-grab-focus! It seems plausible that Mutter's focus-stealing prevention kicks in in case wl-clipboard is run from a .desktop file and not "directly". On the other hand, it seems unlikely that Mutter is able to cross-reference wl-clipboard's Wayland connection to the .desktop file it has previously launched, since it's not sandboxed in any way, and in this case is done from a different process.

If that's the case, there should be a proper startup token in the env that Mutter wants us to use to get focus. I went ahead and filed https://github.com/bugaevc/wl-clipboard/issues/169 to implement support for that.

Silejonu commented 1 year ago

I have deleted my previous message because I had not correctly copied the command you asked me to try. I had done this instead:

$(echo Running wl-copy as PID $BASHPID && WAYLAND_DEBUG=1 exec wl-copy Text from wl-copy_debug.sh) |& logger
logger wl-copy has returned $?
bugaevc commented 1 year ago

I have pushed a couple of commits that should hopefully help with this. Could you please build the latest wl-clipboard from source (with all the optional dependencies present, otherwise it won't have any effect!) and try this again?

Silejonu commented 1 year ago

Sadly this didn't help.
I installed wayland-devel and wayland-protocols-devel, which were not previously installed, before building wl-clipboard.

Result of gdb for /usr/bin/bash /usr/local/bin/wl-copy_debug.sh:

(gdb) bt
#0  0x00007f4e2e300537 in __GI___wait4 (pid=pid@entry=-1, 
    stat_loc=stat_loc@entry=0x7ffc05a9b110, 
    options=options@entry=0, usage=usage@entry=0x0)
    at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f4e2e3004fb in __GI___waitpid (pid=pid@entry=-1, 
    stat_loc=stat_loc@entry=0x7ffc05a9b110, 
    options=options@entry=0) at waitpid.c:38
#2  0x000055f196763aa1 in waitchld.constprop.0 (
    block=block@entry=1, wpid=<optimized out>)
    at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/jobs.c:3800
#3  0x000055f1966c30b2 in wait_for (pid=15848, flags=0)
    at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/jobs.c:2980
#4  0x000055f1966a7722 in execute_command_internal (
    command=command@entry=0x55f1968d8750, 
    asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=3, pipe_out=pipe_out@entry=-1, 
    fds_to_close=fds_to_close@entry=0x55f1968d8860)
    at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:923
#5  0x000055f1966a40b0 in execute_pipeline (
    command=command@entry=0x55f1968d8830, 
    asynchronous=asynchronous@entry=0, 
    pipe_in=<optimized out>, pipe_out=pipe_out@entry=-1, 
    fds_to_close=fds_to_close@entry=0x55f1968d8860)
    at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:2648
#6  0x000055f1966a4c95 in execute_connection (
    fds_to_close=0x55f1968d8860, pipe_out=-1, 
    pipe_in=<optimized out>, asynchronous=0, 
    command=0x55f1968d8830)
    at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:2787
#7  execute_command_internal (

Result of gdb for wl-copy Text from wl-copy_debug.sh:

(gdb) bt
#0  0x00007f8ea083e1e4 in __GI___poll (fds=fds@entry=0x7ffec0cb9910, nfds=nfds@entry=1, timeout=timeout@entry=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f8ea09261d4 in poll (__timeout=-1, __nfds=1, __fds=0x7ffec0cb9910) at /usr/include/bits/poll2.h:39
#2  wl_display_poll (display=0x21372a0, events=1) at ../src/wayland-client.c:1878
#3  wl_display_dispatch_queue (queue=<optimized out>, display=<optimized out>) at ../src/wayland-client.c:1951
#4  wl_display_dispatch_queue (display=0x21372a0, queue=0x2137370) at ../src/wayland-client.c:1924
#5  0x0000000000402b48 in main (argc=4, argv=0x7ffec0cb9ab8) at ../src/wl-copy.c:311

The weird thing is that I initially thought it helped, as I tested it in a VM first. But my issue was not reproducible there. The bug is present of two different machines, one on Fedora 37, the other on Arch Linux with GNOME. I could not reproduce the bug in a VM in Fedora nor Arch. I tried to reproduce it on some spare bare metal machines (one on Arch with KDE Plasma, the other on Fedora 37), thinking it could have something to do with my VMs, but I could not reproduce the bug either.
If it was only one machine that had an issue, I would have thought my installation was problematic, but this happens on two different machines with two different systems.

Silejonu commented 1 year ago

As an aside, I just tried downgrading Mutter to version 43.3 on Arch Linux (it was previously on version 43.4), and it did fix the issue (with wl-clipboard installed through the Arch repos).

bugaevc commented 1 year ago

Result of gdb for /usr/bin/bash /usr/local/bin/wl-copy_debug.sh

This is just a backtrace of bash waiting for wl-copy to exit, that's not very useful...

Could you please get me WAYLAND_DEBUG=1 logs of the hanging wl-copy session? I'm interested to see if it does end up using gtk-shell. You could use WAYLAND_DEBUG=1 wl-copy some text |& logger or even WAYLAND_DEBUG=1 systemd-cat wl-copy some text, and then look for it in the journal.

As an aside, I just tried downgrading Mutter to version 43.3 on Arch Linux (it was previously on version 43.4), and it did fix the issue

This is very interesting! So it might be this Mutter commit: https://gitlab.gnome.org/GNOME/mutter/-/commit/dac79fdceddb56293be39c087c68a36cf8cd6f37

bugaevc commented 1 year ago

Looks like this is indeed a regression introduced by that Mutter commit, and https://gitlab.gnome.org/GNOME/mutter/-/issues/2690 and https://gitlab.gnome.org/GNOME/mutter/-/issues/2739 are the relevant Mutter issues to follow.

Silejonu commented 1 year ago

Result of WAYLAND_DEBUG=1 wl-copy some text |& logger ran from a .desktop file on the problematic Fedora 37 install, with wl-clipboard built from GitHub:

Same, but with WAYLAND_DEBUG=1 systemd-cat wl-copy some text:

bugaevc commented 1 year ago

Interesting — so gtk_surface1.present(0) is still not enough to get raised with that commit. Could you please try to specify StartupNotify=true in the .desktop file and see if that helps?

As a side note, posting backlinks to here on Mutter's issue tracker is unlikely to help, since Mutter developers (rightfully) aren't interested in keeping the popup surface hack working. In a way, we're living on borrowed time with this already: some time (maybe in a couple of years, maybe sooner), Mutter developers will flip the switch and stop giving new windows focus ever (unless proper activation tokens are used), so wl-clipboard will stop working on Mutter entirely.

A proper way out of this situation would be for Mutter to accept that yes, people will always want to access their clipboard from command line (and that it is not the same as external clipboard managers), to implement a better clipboard protocol that does not require the stealing focus hack while ensuring that this protocol is only exposed to unsandboxed clients (so security & privacy are maintained). But Mutter developers have made it clear that they're not interested in doing that either.

Silejonu commented 1 year ago

Here is the output of journalctl after adding the line StartupNotify=true:

avril 10 15:26:30 framework systemd[1721]: gnome-terminal-server.service: Unit process 4737 (wl-copy) remains running after unit stopped.
avril 10 15:26:33 framework sudo[4840]: pam_unix(sudo:session): session closed for user root
avril 10 15:26:33 framework audit[4840]: USER_END pid=4840 uid=1000 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_limits,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
avril 10 15:26:33 framework audit[4840]: CRED_DISP pid=4840 uid=1000 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_fprintd acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
avril 10 15:26:40 framework systemd[1721]: Started vte-spawn-0098b213-d06c-4807-b381-b931fe0fe4f7.scope - VTE child process 5365 launched by kgx process 3883.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.Boxes.SearchProvider@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.Calculator.SearchProvider@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.Characters@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.Contacts.SearchProvider@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.Nautilus@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.Photos@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.Settings.SearchProvider@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.clocks@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.seahorse.Application@1.service.
avril 10 15:26:57 framework systemd[1721]: Starting gnome-terminal-server.service - GNOME Terminal Server...
avril 10 15:26:57 framework nautilus[5553]: Connecting to org.freedesktop.Tracker3.Miner.Files
avril 10 15:26:57 framework systemd[1721]: Started gnome-terminal-server.service - GNOME Terminal Server.
avril 10 15:26:57 framework gnome-character[5549]: JS LOG: Characters Application started
avril 10 15:26:57 framework nautilus[5553]: g_hash_table_foreach: assertion 'hash_table != NULL' failed
avril 10 15:26:57 framework gnome-shell[1840]: Received error from D-Bus search provider org.gnome.Terminal.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: L’objet n’existe pas à l’emplacement « /org/gnome/Terminal/SearchProvider »
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-org.gnome.DiskUtility@1.service.
avril 10 15:26:57 framework systemd[1721]: Started dbus-:1.2-com.intel.dleyna\x2drenderer@1.service.
avril 10 15:26:57 framework dleyna-renderer-service[5694]: dLeyna core version 0.6.0
avril 10 15:26:57 framework dleyna-renderer-service[5694]: dleyna-renderer-service version 0.6.0
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Type[0] Level[0x13] Mask[0x4C] Flags[0x4F]
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Load file [/home/silejonu/.config/dleyna-renderer-service.conf]
avril 10 15:26:57 framework dleyna-renderer-service[5694]: [General settings]
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Never Quit: F
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Connector Name: dbus
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Port: 0
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Push host port: 0
avril 10 15:26:57 framework dleyna-renderer-service[5694]: [Logging settings]
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Log Type : 0
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Log Level: 0x13
avril 10 15:26:57 framework dleyna-renderer-service[5694]: [Network filtering settings]
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Enabled : F
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Entries: (null)
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Calling GetRenderers method
avril 10 15:26:57 framework dleyna-renderer-service[5694]: Client :1.138 lost
avril 10 15:26:58 framework systemd[1721]: Started app-gnome-wl\x2dcopy_debug-5703.scope - Application launched by gnome-shell.
avril 10 15:26:58 framework silejonu[5723]: [1414184.474]  -> wl_display@1.get_registry(new id wl_registry@2)
avril 10 15:26:58 framework silejonu[5723]: [1414184.501]  -> wl_display@1.sync(new id wl_callback@3)
avril 10 15:26:58 framework silejonu[5723]: [1414184.934] wl_display@1.delete_id(3)
avril 10 15:26:58 framework silejonu[5723]: [1414184.944] wl_registry@2.global(1, "wl_compositor", 5)
avril 10 15:26:58 framework silejonu[5723]: [1414184.949]  -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
avril 10 15:26:58 framework silejonu[5723]: [1414184.952] wl_registry@2.global(2, "wl_drm", 2)
avril 10 15:26:58 framework silejonu[5723]: [1414184.954] wl_registry@2.global(3, "wl_shm", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.955]  -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@5)
avril 10 15:26:58 framework silejonu[5723]: [1414184.957] wl_registry@2.global(4, "wl_output", 3)
avril 10 15:26:58 framework silejonu[5723]: [1414184.959] wl_registry@2.global(5, "zxdg_output_manager_v1", 3)
avril 10 15:26:58 framework silejonu[5723]: [1414184.961] wl_registry@2.global(6, "wl_data_device_manager", 3)
avril 10 15:26:58 framework silejonu[5723]: [1414184.963]  -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@6)
avril 10 15:26:58 framework silejonu[5723]: [1414184.965] wl_registry@2.global(7, "zwp_primary_selection_device_manager_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.966]  -> wl_registry@2.bind(7, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@7)
avril 10 15:26:58 framework silejonu[5723]: [1414184.968] wl_registry@2.global(8, "wl_subcompositor", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.969] wl_registry@2.global(9, "xdg_wm_base", 4)
avril 10 15:26:58 framework silejonu[5723]: [1414184.973]  -> wl_registry@2.bind(9, "xdg_wm_base", 1, new id [unknown]@8)
avril 10 15:26:58 framework silejonu[5723]: [1414184.975] wl_registry@2.global(10, "gtk_shell1", 5)
avril 10 15:26:58 framework silejonu[5723]: [1414184.977]  -> wl_registry@2.bind(10, "gtk_shell1", 4, new id [unknown]@9)
avril 10 15:26:58 framework silejonu[5723]: [1414184.979] wl_registry@2.global(11, "wp_viewporter", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.981] wl_registry@2.global(12, "zwp_pointer_gestures_v1", 3)
avril 10 15:26:58 framework silejonu[5723]: [1414184.984] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.985] wl_registry@2.global(14, "wl_seat", 8)
avril 10 15:26:58 framework silejonu[5723]: [1414184.987]  -> wl_registry@2.bind(14, "wl_seat", 2, new id [unknown]@10)
avril 10 15:26:58 framework silejonu[5723]: [1414184.990] wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.992] wl_registry@2.global(16, "zwp_pointer_constraints_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.993] wl_registry@2.global(17, "zxdg_exporter_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.995] wl_registry@2.global(18, "zxdg_importer_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414184.996] wl_registry@2.global(19, "zwp_linux_dmabuf_v1", 4)
avril 10 15:26:58 framework silejonu[5723]: [1414184.998] wl_registry@2.global(20, "wp_single_pixel_buffer_manager_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414185.002] wl_registry@2.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414185.004] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414185.005] wl_registry@2.global(23, "wp_presentation", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414185.007] wl_registry@2.global(24, "xdg_activation_v1", 1)
avril 10 15:26:58 framework silejonu[5723]: [1414185.008]  -> wl_registry@2.bind(24, "xdg_activation_v1", 1, new id [unknown]@11)
avril 10 15:26:58 framework silejonu[5723]: [1414185.011] wl_callback@3.done(1598)
avril 10 15:26:58 framework silejonu[5723]: [1414185.014]  -> wl_display@1.sync(new id wl_callback@3)
avril 10 15:26:58 framework silejonu[5723]: [1414185.087] wl_display@1.delete_id(3)
avril 10 15:26:58 framework silejonu[5723]: [1414185.090] wl_seat@10.capabilities(3)
avril 10 15:26:58 framework silejonu[5723]: [1414185.091] wl_seat@10.name("seat0")
avril 10 15:26:58 framework silejonu[5723]: [1414185.094] wl_callback@3.done(1598)
avril 10 15:26:58 framework silejonu[5723]: [1414185.097]  -> wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@10)
avril 10 15:26:58 framework silejonu[5723]: [1414185.101]  -> wl_data_device_manager@6.create_data_source(new id wl_data_source@12)
avril 10 15:26:58 framework silejonu[5723]: [1414185.103]  -> wl_data_source@12.offer("text/plain")
avril 10 15:26:58 framework silejonu[5723]: [1414185.106]  -> wl_data_source@12.offer("text/plain;charset=utf-8")
avril 10 15:26:58 framework silejonu[5723]: [1414185.108]  -> wl_data_source@12.offer("TEXT")
avril 10 15:26:58 framework silejonu[5723]: [1414185.109]  -> wl_data_source@12.offer("STRING")
avril 10 15:26:58 framework silejonu[5723]: [1414185.111]  -> wl_data_source@12.offer("UTF8_STRING")
avril 10 15:26:58 framework silejonu[5723]: [1414185.113]  -> wl_seat@10.get_keyboard(new id wl_keyboard@13)
avril 10 15:26:58 framework silejonu[5723]: [1414185.295] wl_keyboard@13.keymap(1, fd 4, 79023)
avril 10 15:26:58 framework silejonu[5723]: [1414185.319]  -> wl_compositor@4.create_surface(new id wl_surface@14)
avril 10 15:26:58 framework silejonu[5723]: [1414185.322]  -> xdg_wm_base@8.get_xdg_surface(new id xdg_surface@15, wl_surface@14)
avril 10 15:26:58 framework silejonu[5723]: [1414185.324]  -> xdg_surface@15.get_toplevel(new id xdg_toplevel@16)
avril 10 15:26:58 framework silejonu[5723]: [1414185.326]  -> xdg_toplevel@16.set_title("wl-clipboard")
avril 10 15:26:58 framework silejonu[5723]: [1414185.329]  -> gtk_shell1@9.get_gtk_surface(new id gtk_surface1@17, wl_surface@14)
avril 10 15:26:58 framework silejonu[5723]: [1414185.331]  -> wl_surface@14.commit()
avril 10 15:26:58 framework silejonu[5723]: [1414185.333]  -> wl_display@1.sync(new id wl_callback@18)
avril 10 15:26:58 framework silejonu[5723]: [1414187.668] wl_display@1.delete_id(18)
avril 10 15:26:58 framework silejonu[5723]: [1414187.679] xdg_toplevel@16.configure(0, 0, array[0])
avril 10 15:26:58 framework silejonu[5723]: [1414187.683] xdg_surface@15.configure(60)
avril 10 15:26:58 framework silejonu[5723]: [1414187.692]  -> xdg_surface@15.ack_configure(60)
avril 10 15:26:58 framework silejonu[5723]: [1414187.694] wl_callback@18.done(1598)
avril 10 15:26:58 framework silejonu[5723]: [1414187.720]  -> wl_shm@5.create_pool(new id wl_shm_pool@18, fd 5, 4)
avril 10 15:26:58 framework silejonu[5723]: [1414187.728]  -> wl_shm_pool@18.create_buffer(new id wl_buffer@19, 0, 1, 1, 4, 0)
avril 10 15:26:58 framework silejonu[5723]: [1414187.731]  -> wl_surface@14.attach(wl_buffer@19, 0, 0)
avril 10 15:26:58 framework silejonu[5723]: [1414187.734]  -> wl_surface@14.damage(0, 0, 1, 1)
avril 10 15:26:58 framework silejonu[5723]: [1414187.736]  -> gtk_surface1@17.present(0)
avril 10 15:26:58 framework silejonu[5723]: [1414187.747]  -> wl_surface@14.commit()
avril 10 15:26:58 framework gnome-shell[1840]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed
avril 10 15:26:58 framework silejonu[5723]: [1414188.471] xdg_wm_base@8.ping(509449)
avril 10 15:26:58 framework silejonu[5723]: [1414188.482]  -> xdg_wm_base@8.pong(509449)
avril 10 15:26:58 framework systemd[1721]: Started vte-spawn-c4f87607-d7b9-45ca-9cf2-6bcbc34adc38.scope - VTE child process 5721 launched by gnome-terminal-server process 5562.
avril 10 15:26:58 framework dleyna-renderer-service[5694]: dLeyna: Exit
avril 10 15:27:07 framework gnome-character[5549]: JS LOG: Characters Application exiting

Two processes are started:

silejonu      14731   14565  0 10:57 pts/1    00:00:00 /usr/bin/bash /usr/local/bin/wl-copy_debug.sh
silejonu      14732   14731  0 10:57 pts/1    00:00:00 wl-copy some text

First one gives this in gdb:

(gdb) bt
#0  0x00007fbeb3503537 in __GI___wait4 (pid=pid@entry=-1, stat_loc=stat_loc@entry=0x7ffdb5806ca0, options=options@entry=0, usage=usage@entry=0x0)
    at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007fbeb35034fb in __GI___waitpid (pid=pid@entry=-1, stat_loc=stat_loc@entry=0x7ffdb5806ca0, options=options@entry=0) at waitpid.c:38
#2  0x0000557b59c05aa1 in waitchld.constprop.0 (block=block@entry=1, wpid=<optimized out>) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/jobs.c:3800
#3  0x0000557b59b650b2 in wait_for (pid=14732, flags=0) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/jobs.c:2980
#4  0x0000557b59b49722 in execute_command_internal (command=command@entry=0x557b5a8551e0, asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x557b5a8553d0)
    at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:923
#5  0x0000557b59b49a02 in execute_command (command=0x557b5a8551e0) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/execute_cmd.c:417
#6  0x0000557b59b398ea in reader_loop () at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/eval.c:172
#7  0x0000557b59b30c9e in main (argc=2, argv=0x7ffdb5807388, env=0x7ffdb58073a0) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/shell.c:843

Second one gives this:

(gdb) bt
#0  0x00007f2ae7a911e4 in __GI___poll (fds=fds@entry=0x7ffc945a4d70, nfds=nfds@entry=1, timeout=timeout@entry=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f2ae7b791d4 in poll (__timeout=-1, __nfds=1, __fds=0x7ffc945a4d70) at /usr/include/bits/poll2.h:39
#2  wl_display_poll (display=0x150a2a0, events=1) at ../src/wayland-client.c:1878
#3  wl_display_dispatch_queue (queue=<optimized out>, display=<optimized out>) at ../src/wayland-client.c:1951
#4  wl_display_dispatch_queue (display=0x150a2a0, queue=0x150a370) at ../src/wayland-client.c:1924
#5  0x0000000000402b48 in main (argc=3, argv=0x7ffc945a4f18) at ../src/wl-copy.c:311
Araly commented 1 year ago

hey, I have an issue where wl-copy hangs indefinitely anytime I run it, but not just from a .desktop file.

for example when ran in a terminal, you can see I start wl-copy and let it hang for 4 seconds before I CTRL+C:

╭─araly@computer /home/araly  ‹system› 
╰─$ time wl-copy aoeu                                                                                                                                                                                                                                                                                                                                                                                                                 ↵ 130
^C
________________________________________________________
Executed in    4.12 secs      fish           external
   usr time    1.14 millis  346.00 micros  791.00 micros
   sys time    0.01 millis   13.00 micros    0.00 micros

╭─araly@computer /home/araly  ‹system› 
╰─$

found the issue while using gopass, if I try to copy a password to the clipboard using gopass -c <secret-name> it just hangs until I kill it, and then says it couldn't copy to clipboard:

╭─araly@computer /home/araly  ‹system› 
╰─$ gopass -c <secret-name>                                                                                                                                                                                                                                                                                                                                                                                                               ↵ 11
^C
Error: failed to write to clipboard: failed to write to clipboard: signal: interrupt
╭─araly@computer /home/araly  ‹system› 
╰─$ 

I use mutter version 44.1 if relevant.

Is this the same issue ? or should I create a new issue instead ?

bugaevc commented 1 year ago

Please create a new issue, and make sure to specify more details about your system & attach WAYLAND_DEBUG=1 logs.

Araly commented 1 year ago

Please create a new issue, and make sure to specify more details about your system & attach WAYLAND_DEBUG=1 logs.

it looks like I can recreate my issue in a specific terminal (guake) but not in another one (kitty) so I have to assume there's something going on with X and wayland.

so just discard my comments

xundeenergie commented 1 year ago

I just faced the same problem, i think.

I stumbled upon pass is not working correctly. When i run pass from a gnome-terminal it works. But when i run it from ddterm it hangs and in dash is a new symbol "Unknown" and when i click on Details, i see wl-clipboard. Klicking on this "unknown application" Icon or changing with alt+tab to this app, the stuff gets copied.

ddterm is a dropdown-shell extension for gnome.

The same, when i run from ddterm WAYLAND_DEBUG=1 wl-copy blabla -o -f i get this in terminal

[1841974.301]  -> wl_display@1.get_registry(new id wl_registry@2)
[1841974.353]  -> wl_display@1.sync(new id wl_callback@3)
[1841974.625] wl_display@1.delete_id(3)
[1841974.654] wl_registry@2.global(1, "wl_compositor", 5)
[1841974.662]  -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[1841974.669] wl_registry@2.global(2, "wl_drm", 2)
[1841974.673] wl_registry@2.global(3, "wl_shm", 1)
[1841974.677]  -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@5)
[1841974.681] wl_registry@2.global(4, "wl_output", 3)
[1841974.685] wl_registry@2.global(5, "zxdg_output_manager_v1", 3)
[1841974.689] wl_registry@2.global(6, "wl_data_device_manager", 3)
[1841974.693]  -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@6)
[1841974.697] wl_registry@2.global(7, "zwp_primary_selection_device_manager_v1", 1)
[1841974.701]  -> wl_registry@2.bind(7, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@7)
[1841974.706] wl_registry@2.global(8, "wl_subcompositor", 1)
[1841974.709] wl_registry@2.global(9, "xdg_wm_base", 4)
[1841974.717]  -> wl_registry@2.bind(9, "xdg_wm_base", 1, new id [unknown]@8)
[1841974.722] wl_registry@2.global(10, "gtk_shell1", 5)
[1841974.728] wl_registry@2.global(11, "wp_viewporter", 1)
[1841974.733] wl_registry@2.global(12, "zwp_pointer_gestures_v1", 3)
[1841974.739] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
[1841974.743] wl_registry@2.global(14, "wl_seat", 8)
[1841974.749]  -> wl_registry@2.bind(14, "wl_seat", 2, new id [unknown]@9)
[1841974.756] wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1)
[1841974.761] wl_registry@2.global(16, "zwp_pointer_constraints_v1", 1)
[1841974.766] wl_registry@2.global(17, "zxdg_exporter_v1", 1)
[1841974.770] wl_registry@2.global(18, "zxdg_importer_v1", 1)
[1841974.780] wl_registry@2.global(19, "zwp_linux_dmabuf_v1", 4)
[1841974.785] wl_registry@2.global(20, "wp_single_pixel_buffer_manager_v1", 1)
[1841974.790] wl_registry@2.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[1841974.794] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
[1841974.800] wl_registry@2.global(23, "wp_presentation", 1)
[1841974.805] wl_registry@2.global(24, "xdg_activation_v1", 1)
[1841974.811] wl_callback@3.done(16178)
[1841974.817]  -> wl_display@1.sync(new id wl_callback@3)
[1841975.126] wl_display@1.delete_id(3)
[1841975.148] wl_seat@9.capabilities(3)
[1841975.153] wl_seat@9.name("seat0")
[1841975.157] wl_callback@3.done(16178)
[1841975.164]  -> wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@9)
[1841975.172]  -> wl_data_device_manager@6.create_data_source(new id wl_data_source@10)
[1841975.177]  -> wl_data_source@10.offer("text/plain")
[1841975.182]  -> wl_data_source@10.offer("text/plain;charset=utf-8")
[1841975.185]  -> wl_data_source@10.offer("TEXT")
[1841975.189]  -> wl_data_source@10.offer("STRING")
[1841975.192]  -> wl_data_source@10.offer("UTF8_STRING")
[1841975.197]  -> wl_seat@9.get_keyboard(new id wl_keyboard@11)
[1841975.706] wl_keyboard@11.keymap(1, fd 4, 69818)
[1841975.764]  -> wl_compositor@4.create_surface(new id wl_surface@12)
[1841975.772]  -> xdg_wm_base@8.get_xdg_surface(new id xdg_surface@13, wl_surface@12)
[1841975.777]  -> xdg_surface@13.get_toplevel(new id xdg_toplevel@14)
[1841975.781]  -> xdg_toplevel@14.set_title("wl-clipboard")
[1841975.787]  -> wl_surface@12.commit()
[1841975.792]  -> wl_display@1.sync(new id wl_callback@15)
[1841979.403] wl_display@1.delete_id(15)
[1841979.425] xdg_toplevel@14.configure(0, 0, array[0])
[1841979.445] xdg_surface@13.configure(1022)
[1841979.452]  -> xdg_surface@13.ack_configure(1022)
[1841979.459] wl_callback@15.done(16178)
[1841979.495]  -> wl_shm@5.create_pool(new id wl_shm_pool@15, fd 5, 4)
[1841979.508]  -> wl_shm_pool@15.create_buffer(new id wl_buffer@16, 0, 1, 1, 4, 0)
[1841979.518]  -> wl_surface@12.attach(wl_buffer@16, 0, 0)
[1841979.523]  -> wl_surface@12.damage(0, 0, 1, 1)
[1841979.528]  -> wl_surface@12.commit()

here it hangs and Gnome Dash shows this grafik When i click on it, this follows in ddterm

[2018794.948] xdg_toplevel@14.configure(1, 1, array[4])
[2018794.970] xdg_surface@13.configure(1034)
[2018794.976]  -> xdg_surface@13.ack_configure(1034)
[2018794.981] xdg_wm_base@8.ping(101114331)
[2018794.985]  -> xdg_wm_base@8.pong(101114331)
[2018794.989] wl_keyboard@11.modifiers(17034, 0, 0, 0, 0)
[2018794.995] wl_keyboard@11.enter(17034, wl_surface@12, array[0])
[2018795.002]  -> wl_data_device@3.set_selection(wl_data_source@10, 17034)
[2018795.017]  -> wl_display@1.sync(new id wl_callback@17)
[2018795.025] wl_data_device@3.data_offer(new id wl_data_offer@4278190080)
[2018795.032] wl_data_offer@4278190080.offer("image/png")
[2018795.036] wl_data_device@3.selection(wl_data_offer@4278190080)
[2018798.275] wl_display@1.delete_id(17)
[2018798.285] wl_data_device@3.data_offer(new id wl_data_offer@4278190081)
[2018798.288] wl_data_offer@4278190081.offer("UTF8_STRING")
[2018798.291] wl_data_offer@4278190081.offer("STRING")
[2018798.294] wl_data_offer@4278190081.offer("TEXT")
[2018798.296] wl_data_offer@4278190081.offer("text/plain;charset=utf-8")
[2018798.299] wl_data_offer@4278190081.offer("text/plain")
[2018798.301] wl_data_device@3.selection(wl_data_offer@4278190081)
[2018798.304] wl_data_source@10.send("text/plain;charset=utf-8", fd 5)

and the command finishes.

Then the same is on wl-paste, but in gnome-terminal

~: $ WAYLAND_DEBUG=1 wl-paste -n
[2213085.583]  -> wl_display@1.get_registry(new id wl_registry@2)
[2213085.609]  -> wl_display@1.sync(new id wl_callback@3)
[2213085.921] wl_display@1.delete_id(3)
[2213085.948] wl_registry@2.global(1, "wl_compositor", 5)
[2213085.955]  -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[2213085.962] wl_registry@2.global(2, "wl_drm", 2)
[2213085.966] wl_registry@2.global(3, "wl_shm", 1)
[2213085.969]  -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@5)
[2213085.973] wl_registry@2.global(4, "wl_output", 3)
[2213085.977] wl_registry@2.global(5, "zxdg_output_manager_v1", 3)
[2213085.980] wl_registry@2.global(6, "wl_data_device_manager", 3)
[2213085.984]  -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@6)
[2213085.988] wl_registry@2.global(7, "zwp_primary_selection_device_manager_v1", 1)
[2213085.992]  -> wl_registry@2.bind(7, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@7)
[2213085.996] wl_registry@2.global(8, "wl_subcompositor", 1)
[2213085.999] wl_registry@2.global(9, "xdg_wm_base", 4)
[2213086.006]  -> wl_registry@2.bind(9, "xdg_wm_base", 1, new id [unknown]@8)
[2213086.012] wl_registry@2.global(10, "gtk_shell1", 5)
[2213086.017] wl_registry@2.global(11, "wp_viewporter", 1)
[2213086.025] wl_registry@2.global(12, "zwp_pointer_gestures_v1", 3)
[2213086.031] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
[2213086.035] wl_registry@2.global(14, "wl_seat", 8)
[2213086.040]  -> wl_registry@2.bind(14, "wl_seat", 2, new id [unknown]@9)
[2213086.045] wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1)
[2213086.051] wl_registry@2.global(16, "zwp_pointer_constraints_v1", 1)
[2213086.055] wl_registry@2.global(17, "zxdg_exporter_v1", 1)
[2213086.059] wl_registry@2.global(18, "zxdg_importer_v1", 1)
[2213086.062] wl_registry@2.global(19, "zwp_linux_dmabuf_v1", 4)
[2213086.067] wl_registry@2.global(20, "wp_single_pixel_buffer_manager_v1", 1)
[2213086.072] wl_registry@2.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[2213086.078] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
[2213086.083] wl_registry@2.global(23, "wp_presentation", 1)
[2213086.090] wl_registry@2.global(24, "xdg_activation_v1", 1)
[2213086.095] wl_callback@3.done(17923)
[2213086.101]  -> wl_display@1.sync(new id wl_callback@3)
[2213086.200] wl_display@1.delete_id(3)
[2213086.207] wl_seat@9.capabilities(3)
[2213086.210] wl_seat@9.name("seat0")
[2213086.214] wl_callback@3.done(17923)
[2213086.219]  -> wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@9)
[2213086.226]  -> wl_seat@9.get_keyboard(new id wl_keyboard@10)
[2213086.535] wl_keyboard@10.keymap(1, fd 4, 69818)
[2213086.589]  -> wl_compositor@4.create_surface(new id wl_surface@11)
[2213086.596]  -> xdg_wm_base@8.get_xdg_surface(new id xdg_surface@12, wl_surface@11)
[2213086.601]  -> xdg_surface@12.get_toplevel(new id xdg_toplevel@13)
[2213086.605]  -> xdg_toplevel@13.set_title("wl-clipboard")
[2213086.609]  -> wl_surface@11.commit()
[2213086.614]  -> wl_display@1.sync(new id wl_callback@14)
[2213089.688] wl_display@1.delete_id(14)
[2213089.707] xdg_toplevel@13.configure(0, 0, array[0])
[2213089.713] xdg_surface@12.configure(1064)
[2213089.717]  -> xdg_surface@12.ack_configure(1064)
[2213089.721] wl_callback@14.done(17923)
[2213089.748]  -> wl_shm@5.create_pool(new id wl_shm_pool@14, fd 5, 4)
[2213089.755]  -> wl_shm_pool@14.create_buffer(new id wl_buffer@15, 0, 1, 1, 4, 0)
[2213089.765]  -> wl_surface@11.attach(wl_buffer@15, 0, 0)
[2213089.771]  -> wl_surface@11.damage(0, 0, 1, 1)
[2213089.775]  -> wl_surface@11.commit()
[2213107.517] xdg_toplevel@13.configure(1, 1, array[4])
[2213107.528] xdg_surface@12.configure(1066)
[2213107.530]  -> xdg_surface@12.ack_configure(1066)
[2213107.532] wl_keyboard@10.modifiers(17925, 0, 0, 0, 0)
[2213107.534] wl_keyboard@10.enter(17925, wl_surface@11, array[4])
[2213107.536] wl_data_device@3.data_offer(new id wl_data_offer@4278190080)
[2213107.538] wl_data_offer@4278190080.offer("text/plain;charset=utf-8")
[2213107.540] wl_data_device@3.selection(wl_data_offer@4278190080)
[2213107.551]  -> wl_data_offer@4278190080.receive("text/plain;charset=utf-8", fd 7)
[2213107.555]  -> xdg_toplevel@13.destroy()
[2213107.556]  -> xdg_surface@12.destroy()
[2213107.557]  -> wl_surface@11.destroy()
[2213107.559]  -> wl_display@1.sync(new id wl_callback@16)
[2213113.479] wl_display@1.delete_id(13)
[2213113.488] wl_display@1.delete_id(12)
[2213113.489] wl_display@1.delete_id(11)
[2213113.490] wl_display@1.delete_id(16)
[2213113.491] wl_keyboard@10.leave(17926, nil)
[2213113.493] wl_callback@16.done(17927)
blabla[2213114.228]  -> wl_data_offer@4278190080.destroy()
( 0 ✓) jakobus.schuerz@tag-618 (03:04)
~: $ WAYLAND_DEBUG=1 wl-paste -n
[2222642.505]  -> wl_display@1.get_registry(new id wl_registry@2)
[2222642.534]  -> wl_display@1.sync(new id wl_callback@3)
[2222642.785] wl_display@1.delete_id(3)
[2222642.813] wl_registry@2.global(1, "wl_compositor", 5)
[2222642.821]  -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[2222642.828] wl_registry@2.global(2, "wl_drm", 2)
[2222642.832] wl_registry@2.global(3, "wl_shm", 1)
[2222642.836]  -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@5)
[2222642.841] wl_registry@2.global(4, "wl_output", 3)
[2222642.844] wl_registry@2.global(5, "zxdg_output_manager_v1", 3)
[2222642.848] wl_registry@2.global(6, "wl_data_device_manager", 3)
[2222642.852]  -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@6)
[2222642.856] wl_registry@2.global(7, "zwp_primary_selection_device_manager_v1", 1)
[2222642.860]  -> wl_registry@2.bind(7, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@7)
[2222642.865] wl_registry@2.global(8, "wl_subcompositor", 1)
[2222642.869] wl_registry@2.global(9, "xdg_wm_base", 4)
[2222642.876]  -> wl_registry@2.bind(9, "xdg_wm_base", 1, new id [unknown]@8)
[2222642.883] wl_registry@2.global(10, "gtk_shell1", 5)
[2222642.887] wl_registry@2.global(11, "wp_viewporter", 1)
[2222642.891] wl_registry@2.global(12, "zwp_pointer_gestures_v1", 3)
[2222642.895] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
[2222642.903] wl_registry@2.global(14, "wl_seat", 8)
[2222642.909]  -> wl_registry@2.bind(14, "wl_seat", 2, new id [unknown]@9)
[2222642.918] wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1)
[2222642.922] wl_registry@2.global(16, "zwp_pointer_constraints_v1", 1)
[2222642.927] wl_registry@2.global(17, "zxdg_exporter_v1", 1)
[2222642.932] wl_registry@2.global(18, "zxdg_importer_v1", 1)
[2222642.936] wl_registry@2.global(19, "zwp_linux_dmabuf_v1", 4)
[2222642.942] wl_registry@2.global(20, "wp_single_pixel_buffer_manager_v1", 1)
[2222642.951] wl_registry@2.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[2222642.956] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
[2222642.961] wl_registry@2.global(23, "wp_presentation", 1)
[2222642.965] wl_registry@2.global(24, "xdg_activation_v1", 1)
[2222642.970] wl_callback@3.done(17952)
[2222642.979]  -> wl_display@1.sync(new id wl_callback@3)
[2222643.290] wl_display@1.delete_id(3)
[2222643.312] wl_seat@9.capabilities(3)
[2222643.317] wl_seat@9.name("seat0")
[2222643.321] wl_callback@3.done(17952)
[2222643.328]  -> wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@9)
[2222643.336]  -> wl_seat@9.get_keyboard(new id wl_keyboard@10)
[2222643.819] wl_keyboard@10.keymap(1, fd 4, 69818)
[2222643.872]  -> wl_compositor@4.create_surface(new id wl_surface@11)
[2222643.880]  -> xdg_wm_base@8.get_xdg_surface(new id xdg_surface@12, wl_surface@11)
[2222643.885]  -> xdg_surface@12.get_toplevel(new id xdg_toplevel@13)
[2222643.889]  -> xdg_toplevel@13.set_title("wl-clipboard")
[2222643.893]  -> wl_surface@11.commit()
[2222643.898]  -> wl_display@1.sync(new id wl_callback@14)
[2222646.284] wl_display@1.delete_id(14)
[2222646.306] xdg_toplevel@13.configure(0, 0, array[0])
[2222646.312] xdg_surface@12.configure(1077)
[2222646.317]  -> xdg_surface@12.ack_configure(1077)
[2222646.339] wl_callback@14.done(17952)
[2222646.386]  -> wl_shm@5.create_pool(new id wl_shm_pool@14, fd 5, 4)
[2222646.396]  -> wl_shm_pool@14.create_buffer(new id wl_buffer@15, 0, 1, 1, 4, 0)
[2222646.402]  -> wl_surface@11.attach(wl_buffer@15, 0, 0)
[2222646.407]  -> wl_surface@11.damage(0, 0, 1, 1)
[2222646.411]  -> wl_surface@11.commit()

here the command hangs, and a icon in gnome-dash appears. The same as with wl-copy

clicking on it, the command finishes with

[2213107.517] xdg_toplevel@13.configure(1, 1, array[4])
[2213107.528] xdg_surface@12.configure(1066)
[2213107.530]  -> xdg_surface@12.ack_configure(1066)
[2213107.532] wl_keyboard@10.modifiers(17925, 0, 0, 0, 0)
[2213107.534] wl_keyboard@10.enter(17925, wl_surface@11, array[4])
[2213107.536] wl_data_device@3.data_offer(new id wl_data_offer@4278190080)
[2213107.538] wl_data_offer@4278190080.offer("text/plain;charset=utf-8")
[2213107.540] wl_data_device@3.selection(wl_data_offer@4278190080)
[2213107.551]  -> wl_data_offer@4278190080.receive("text/plain;charset=utf-8", fd 7)
[2213107.555]  -> xdg_toplevel@13.destroy()
[2213107.556]  -> xdg_surface@12.destroy()
[2213107.557]  -> wl_surface@11.destroy()
[2213107.559]  -> wl_display@1.sync(new id wl_callback@16)
[2213113.479] wl_display@1.delete_id(13)
[2213113.488] wl_display@1.delete_id(12)
[2213113.489] wl_display@1.delete_id(11)
[2213113.490] wl_display@1.delete_id(16)
[2213113.491] wl_keyboard@10.leave(17926, nil)
[2213113.493] wl_callback@16.done(17927)
blabla[2213114.228]  -> wl_data_offer@4278190080.destroy()
( 0 ✓) jakobus.schuerz@tag-618 (03:04)
~: $ WAYLAND_DEBUG=1 wl-paste -n
[2222642.505]  -> wl_display@1.get_registry(new id wl_registry@2)
[2222642.534]  -> wl_display@1.sync(new id wl_callback@3)
[2222642.785] wl_display@1.delete_id(3)
[2222642.813] wl_registry@2.global(1, "wl_compositor", 5)
[2222642.821]  -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[2222642.828] wl_registry@2.global(2, "wl_drm", 2)
[2222642.832] wl_registry@2.global(3, "wl_shm", 1)
[2222642.836]  -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@5)
[2222642.841] wl_registry@2.global(4, "wl_output", 3)
[2222642.844] wl_registry@2.global(5, "zxdg_output_manager_v1", 3)
[2222642.848] wl_registry@2.global(6, "wl_data_device_manager", 3)
[2222642.852]  -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@6)
[2222642.856] wl_registry@2.global(7, "zwp_primary_selection_device_manager_v1", 1)
[2222642.860]  -> wl_registry@2.bind(7, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@7)
[2222642.865] wl_registry@2.global(8, "wl_subcompositor", 1)
[2222642.869] wl_registry@2.global(9, "xdg_wm_base", 4)
[2222642.876]  -> wl_registry@2.bind(9, "xdg_wm_base", 1, new id [unknown]@8)
[2222642.883] wl_registry@2.global(10, "gtk_shell1", 5)
[2222642.887] wl_registry@2.global(11, "wp_viewporter", 1)
[2222642.891] wl_registry@2.global(12, "zwp_pointer_gestures_v1", 3)
[2222642.895] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
[2222642.903] wl_registry@2.global(14, "wl_seat", 8)
[2222642.909]  -> wl_registry@2.bind(14, "wl_seat", 2, new id [unknown]@9)
[2222642.918] wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1)
[2222642.922] wl_registry@2.global(16, "zwp_pointer_constraints_v1", 1)
[2222642.927] wl_registry@2.global(17, "zxdg_exporter_v1", 1)
[2222642.932] wl_registry@2.global(18, "zxdg_importer_v1", 1)
[2222642.936] wl_registry@2.global(19, "zwp_linux_dmabuf_v1", 4)
[2222642.942] wl_registry@2.global(20, "wp_single_pixel_buffer_manager_v1", 1)
[2222642.951] wl_registry@2.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[2222642.956] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
[2222642.961] wl_registry@2.global(23, "wp_presentation", 1)
[2222642.965] wl_registry@2.global(24, "xdg_activation_v1", 1)
[2222642.970] wl_callback@3.done(17952)
[2222642.979]  -> wl_display@1.sync(new id wl_callback@3)
[2222643.290] wl_display@1.delete_id(3)
[2222643.312] wl_seat@9.capabilities(3)
[2222643.317] wl_seat@9.name("seat0")
[2222643.321] wl_callback@3.done(17952)
[2222643.328]  -> wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@9)
[2222643.336]  -> wl_seat@9.get_keyboard(new id wl_keyboard@10)
[2222643.819] wl_keyboard@10.keymap(1, fd 4, 69818)
[2222643.872]  -> wl_compositor@4.create_surface(new id wl_surface@11)
[2222643.880]  -> xdg_wm_base@8.get_xdg_surface(new id xdg_surface@12, wl_surface@11)
[2222643.885]  -> xdg_surface@12.get_toplevel(new id xdg_toplevel@13)
[2222643.889]  -> xdg_toplevel@13.set_title("wl-clipboard")
[2222643.893]  -> wl_surface@11.commit()
[2222643.898]  -> wl_display@1.sync(new id wl_callback@14)
[2222646.284] wl_display@1.delete_id(14)
[2222646.306] xdg_toplevel@13.configure(0, 0, array[0])
[2222646.312] xdg_surface@12.configure(1077)
[2222646.317]  -> xdg_surface@12.ack_configure(1077)
[2222646.339] wl_callback@14.done(17952)
[2222646.386]  -> wl_shm@5.create_pool(new id wl_shm_pool@14, fd 5, 4)
[2222646.396]  -> wl_shm_pool@14.create_buffer(new id wl_buffer@15, 0, 1, 1, 4, 0)
[2222646.402]  -> wl_surface@11.attach(wl_buffer@15, 0, 0)
[2222646.407]  -> wl_surface@11.damage(0, 0, 1, 1)
[2222646.411]  -> wl_surface@11.commit()
[2260387.275]  -> wl_data_offer@4278190080.destroy()

And gnome-notifications say "wl-copy is ready"

dynobo commented 1 year ago

My experience is exactly the same as described by @xundeenergie: When started from terminal, wl-copy hangs, an "unknown application"-icon appears in the gnome dash, and a notification is shown. wl-copy hangs until I click that icon in the dash, then it resumes and copies text to clipboard correctly. Debug output similar to @xundeenergie 's.

If it helps: I'm using wl-clipboard for a while now, and I think the issue started to occur after Gnome 45 got shipped to Arch via updates.

roman0x58 commented 12 months ago

My experience is exactly the same as described by @xundeenergie: When started from terminal, wl-copy hangs, an "unknown application"-icon appears in the gnome dash, and a notification is shown. wl-copy hangs until I click that icon in the dash, then it resumes and copies text to clipboard correctly. Debug output similar to @xundeenergie 's.

If it helps: I'm using wl-clipboard for a while now, and I think the issue started to occur after Gnome 45 got shipped to Arch via updates.

Yeah, I have the same problem. A GNOME notification appeared when I ran 'wl-copy' from the terminal, and it hung until I clicked on it. I'm also on Arch with Gnome 45.1

drlkf commented 10 months ago

i'm encountering a similar issue when calling wl-copy from a Haskell subprocess, one thing that i noticed is that if any other program writes to the clipboard, the process resumes and the clipboard now contains the contents that the Haskell subprocess was trying to write. also, if Haskell invokes wl-copy with -o, it exits immediately and the clipboard is immediately cleared.

here is the WAYLAND_DEBUG log of the subprocess until it hangs: https://gist.github.com/drlkf/10506ff8a3158eb0b68b5966052a82bb

here is the library i use to spawn the process: https://hackage.haskell.org/package/process-1.6.18.0/docs/System-Process.html#v:readCreateProcessWithExitCode

hope it helps