Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wl-copy infinatly hangs #210

Open
Dialgatrainer02 opened this issue Jan 19, 2024 · 6 comments
Open

wl-copy infinatly hangs #210

Dialgatrainer02 opened this issue Jan 19, 2024 · 6 comments
Labels
not our bug The issue is in some other piece of software involved

Comments

@Dialgatrainer02
Copy link

i can copy fine but trying to pipe into wl-copy hangs forever including the example ls ~/Downloads | wl-copy

what logs can i provide and how do i get them?

@bugaevc
Copy link
Owner

bugaevc commented Jan 19, 2024

Hi!

i can copy fine

Do you mean that wl-copy some text works fine for you, and only hangs when you pipe something into it? Does wl-paste work?

Does the thing you're copying appear in the clipboard despite wl-copy hanging? What distro, Wayland compositor, and version of wl-clipboard is this on?

what logs can i provide and how do i get them?

The Wayland debug log, which you can get like this:

ls ~/Downloads | WAYLAND_DEBUG=1 wl-copy 2>/tmp/wayland-debug.log

and the strace log:

ls ~/Downloads | strace -f wl-copy 2>/tmp/strace.log

@Dialgatrainer02
Copy link
Author

Dialgatrainer02 commented Jan 19, 2024

Do you mean that wl-copy some text works fine for you, and only hangs
when you pipe something into it? Does wl-paste work?

yes i can copy and i can paste it only hangs when trying to use clipboard history with dmenu

ls ~/Downloads | WAYLAND_DEBUG=1 wl-copy 2>/tmp/wayland-debug.log

i ran this and hyprland crashed

ls ~/Downloads | strace -f wl-copy 2>/tmp/strace.log

strace.log

when i copy without piping it work and shows in cliphist however piping something in hsngs untill i ctrl c it

@bugaevc
Copy link
Owner

bugaevc commented Jan 19, 2024

i ran this and hyprland crashed

That certainly sounds like an issue with Hyprland, you should report the crash to them.

strace.log

That looks like wl-copy is waiting for xdg-mime, which is waiting for xprop, which is waiting to connect to X11 (likely Xwayland). Why it needs or uses xprop on Wayland, I don't know.

Are you able to run xprop without it hanging? Are you able to run xdg-mime (e.g. xdg-mime query filetype /etc/os-release) without it hanging? If no, that's where your issue is. You should be able to work around this by specifying the MIME type explicitly, like so: ls ~/Downloads | wl-copy --type text/plain

@Dialgatrainer02
Copy link
Author

xdg mime hangs
with --type it works fine
this is a fresh arch install so im unsure why xdg mime is hanging but thank you for the fix

@bugaevc bugaevc added the not our bug The issue is in some other piece of software involved label Jan 19, 2024
@marmitar
Copy link

marmitar commented May 11, 2024

I'm also having problem here, but I'm not so sure it is xprop's fault. Looking at the code, xdg-mime uses xprop in the detectDE function to figure out the current running Desktop Environment. It does so using XDG_CURRENT_DESKTOP first, which is set in my DE (GNOME), so it woldn't need to touch xprop here. Also, xdg-mime runs really fast when used directly:

~> time xdg-mime query filetype ~/.ssh/id_ed25519_sk.pub
application/vnd.ms-publisher

________________________________________________________
Executed in   16.35 millis    fish           external
   usr time   10.49 millis  889.00 micros    9.60 millis
   sys time    8.18 millis  453.00 micros    7.72 millis

~> time xdg-mime query filetype (cat ~/.ssh/id_ed25519_sk.pub | psub)
text/plain

________________________________________________________
Executed in   19.43 millis    fish           external
   usr time   16.31 millis  202.00 micros   16.11 millis
   sys time    4.13 millis  102.00 micros    4.03 millis

~> time wl-copy < ~/.ssh/id_ed25519_sk.pub

________________________________________________________
Executed in   11.10 secs      fish           external
   usr time    5.30 millis  323.00 micros    4.97 millis
   sys time   21.42 millis  158.00 micros   21.26 millis

~> time wl-copy --type text/plain < ~/.ssh/id_ed25519_sk.pub

________________________________________________________
Executed in   28.33 secs      fish           external
   usr time    3.62 millis  873.00 micros    2.75 millis
   sys time    3.35 millis  416.00 micros    2.94 millis

Weirdly, it seems like CPU time is really low (less than 50 ms), but somehow the running time varies wildly, from 2 seconds up to 1 minute.

Logs

I can't run strace without sudo on my system, so here are the Wayland logs.

WAYLAND_DEBUG=1 wl-copy < ~/.ssh/id_ed25519_sk.pub
[3337414.129]  -> [email protected]_registry(new id wl_registry@2)
[3337414.147]  -> [email protected](new id wl_callback@3)
[3337414.338] [email protected]_id(3)
[3337414.348] [email protected](1, "wl_compositor", 6)
[3337414.355]  -> [email protected](1, "wl_compositor", 2, new id [unknown]@4)
[3337414.362] [email protected](2, "wl_eglstream_display", 1)
[3337414.370] [email protected](3, "wl_drm", 2)
[3337414.375] [email protected](4, "wl_shm", 1)
[3337414.381]  -> [email protected](4, "wl_shm", 1, new id [unknown]@5)
[3337414.391] [email protected](5, "wl_output", 4)
[3337414.397] [email protected](6, "zxdg_output_manager_v1", 3)
[3337414.403] [email protected](7, "wl_data_device_manager", 3)
[3337414.408]  -> [email protected](7, "wl_data_device_manager", 1, new id [unknown]@6)
[3337414.412] [email protected](8, "zwp_primary_selection_device_manager_v1", 1)
[3337414.417]  -> [email protected](8, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@7)
[3337414.422] [email protected](9, "wl_subcompositor", 1)
[3337414.427] [email protected](10, "xdg_wm_base", 6)
[3337414.432]  -> [email protected](10, "xdg_wm_base", 1, new id [unknown]@8)
[3337414.437] [email protected](11, "gtk_shell1", 5)
[3337414.442]  -> [email protected](11, "gtk_shell1", 4, new id [unknown]@9)
[3337414.447] [email protected](12, "wp_viewporter", 1)
[3337414.453] [email protected](13, "wp_fractional_scale_manager_v1", 1)
[3337414.458] [email protected](14, "zwp_pointer_gestures_v1", 3)
[3337414.463] [email protected](15, "zwp_tablet_manager_v2", 1)
[3337414.467] [email protected](16, "wl_seat", 8)
[3337414.472]  -> [email protected](16, "wl_seat", 2, new id [unknown]@10)
[3337414.480] [email protected](17, "zwp_relative_pointer_manager_v1", 1)
[3337414.484] [email protected](18, "zwp_pointer_constraints_v1", 1)
[3337414.490] [email protected](19, "zxdg_exporter_v2", 1)
[3337414.494] [email protected](20, "zxdg_importer_v2", 1)
[3337414.499] [email protected](21, "zxdg_exporter_v1", 1)
[3337414.503] [email protected](22, "zxdg_importer_v1", 1)
[3337414.508] [email protected](23, "zwp_linux_dmabuf_v1", 5)
[3337414.512] [email protected](24, "wp_single_pixel_buffer_manager_v1", 1)
[3337414.517] [email protected](25, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[3337414.521] [email protected](26, "zwp_text_input_manager_v3", 1)
[3337414.525] [email protected](27, "wp_presentation", 1)
[3337414.530] [email protected](28, "xdg_activation_v1", 1)
[3337414.535]  -> [email protected](28, "xdg_activation_v1", 1, new id [unknown]@11)
[3337414.541] [email protected](29, "zwp_idle_inhibit_manager_v1", 1)
[3337414.545] [email protected](6546)
[3337414.550]  -> [email protected](new id wl_callback@3)
[3337414.685] [email protected]_id(3)
[3337414.692] [email protected](3)
[3337414.696] [email protected]("seat0")
[3337414.701] [email protected](6546)
[3337414.707]  -> [email protected]_data_device(new id wl_data_device@3, wl_seat@10)
[3337442.337]  -> [email protected]_data_source(new id wl_data_source@12)
[3337442.349]  -> [email protected]("application/vnd.ms-publisher")
[3337442.354]  -> [email protected]("text/plain")
[3337442.358]  -> [email protected]("text/plain;charset=utf-8")
[3337442.362]  -> [email protected]("TEXT")
[3337442.367]  -> [email protected]("STRING")
[3337442.370]  -> [email protected]("UTF8_STRING")
[3337442.375]  -> [email protected]_keyboard(new id wl_keyboard@13)
[3337442.743] [email protected](1, fd 5, 70198)
[3337442.773]  -> [email protected]_surface(new id wl_surface@14)
[3337442.778]  -> [email protected]_xdg_surface(new id xdg_surface@15, wl_surface@14)
[3337442.783]  -> [email protected]_toplevel(new id xdg_toplevel@16)
[3337442.786]  -> [email protected]_title("wl-clipboard")
[3337442.791]  -> [email protected]_gtk_surface(new id gtk_surface1@17, wl_surface@14)
[3337442.796]  -> [email protected]()
[3337442.800]  -> [email protected](new id wl_callback@18)
[3337445.204] [email protected]_id(18)
[3337445.220] [email protected](0, 0, array[0])
[3337445.225] [email protected](456)
[3337445.230]  -> [email protected]_configure(456)
[3337445.237] [email protected](6546)
[3337445.263]  -> [email protected]_pool(new id wl_shm_pool@18, fd 6, 4)
[3337445.273]  -> [email protected]_buffer(new id wl_buffer@19, 0, 1, 1, 4, 0)
[3337445.280]  -> [email protected](wl_buffer@19, 0, 0)
[3337445.287]  -> [email protected](0, 0, 1, 1)
[3337445.293]  -> [email protected](0)
[3337445.301]  -> [email protected]()
[3337452.414] [email protected](5363667)
[3337452.433]  -> [email protected](5363667)
[3397516.017] [email protected](6552, wl_surface@14, array[0])
[3397516.059]  -> [email protected]_selection(wl_data_source@12, 6552)
[3397516.084]  -> [email protected](new id wl_callback@20)
[3397516.106] [email protected](6552, 0, 0, 16, 0)
[3397516.121] [email protected]_offer(new id wl_data_offer@4278190080)
[3397516.133] [email protected]("text/plain")
[3397516.145] [email protected]("text/plain;charset=utf-8")
[3397516.157] [email protected]("UTF8_STRING")
[3397516.174] [email protected]("STRING")
[3397516.184] [email protected]("TEXT")
[3397516.194] [email protected]("application/glfw+clipboard-2478")
[3397516.205] [email protected](wl_data_offer@4278190080)
[3397516.227]  -> [email protected]()
[3397516.240] [email protected](1, 1, array[4])
[3397516.256] [email protected](458)
[3397516.268]  -> [email protected]_configure(458)
[3397516.693] [email protected]_id(20)
[3397516.715] [email protected]_offer(new id wl_data_offer@4278190081)
[3397516.734] [email protected]("UTF8_STRING")
[3397516.778] [email protected]("STRING")
[3397516.788] [email protected]("TEXT")
[3397516.801] [email protected]("text/plain;charset=utf-8")
[3397516.811] [email protected]("text/plain")
[3397516.822] [email protected]("application/vnd.ms-publisher")
[3397516.832] [email protected](wl_data_offer@4278190081)
[3397516.843]  -> [email protected]()
[3397516.854] [email protected]("text/plain;charset=utf-8", fd 6)
[3397519.197] [email protected](6552)
[3397519.227]  -> [email protected]()
[3397519.247]  -> [email protected]()
[3397519.271]  -> [email protected]()
[3397519.282]  -> [email protected]()
[3397521.678] [email protected]_id(16)
[3397521.717] [email protected]_id(15)
[3397521.725] [email protected]_id(17)
[3397521.733] [email protected]_id(14)
[3397521.738] [email protected](6553, nil)
[3425178.637] [email protected]()

@jidanni
Copy link

jidanni commented Jul 15, 2024

In emacs | runs the command shell-command-on-region. Guaranteed to hang when piping into wl-copy. P.S., https://www.emacswiki.org/emacs/CopyAndPaste#h5o-4 says something about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not our bug The issue is in some other piece of software involved
Projects
None yet
Development

No branches or pull requests

4 participants