microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.26k stars 310 forks source link

Cannot copy text *into* Kate editor, copying text *from* Kate works fine. #15

Closed mucki-at closed 2 years ago

mucki-at commented 4 years ago

Environment

Windows build number: Microsoft Windows NT 10.0.21257.0
Your Distribution version: Ubuntu 20.04 LTS
Your WSLG version: 0.2.9.0

Steps to reproduce

WSL logs:

You can access the wslg logs using explorer at: \\wsl\<Distro-Name>\mnt\wslg (eg: \\wsl\Ubuntu-20.04\mnt\wslg)

versions.txt is not copyable (missing permissions): WSLG ( x86_64 ): 0.2.9+Branch.master.Sha.d49cb28cbf4be209347e3b48315081c1b38e4465 wayland: 8cd7c836eaceccc0e4ada7bdac43d86bfe3e0a0a FreeRDP: 297cb96a30ed00e1d7cba1ae9035cfeff82dbfd6 weston: a17db71354ad1c453e10a15805d907c52425499c pulseaudio: 2f0f0b8c3872780f15e275fc12899f4564f01bd5 sharedguestalloc: e2895c6a49105caaa651c05d4b96a46e5a621538

pulseaudio.log weston.log

Expected behavior

copy/past of text works both directions

Actual behavior

can only copy text from linux to windows, but not other way round

hideyukn88 commented 4 years ago

@mucki-at , I'm not able to repro this. Does this repro consistently for you or only sometime ? Copy/paste in both direction works fine for me.

mucki-at commented 4 years ago

It seemed pretty consistent before, but it turns out it is actually random. I tried to see a pattern, but have not been able to find one so far.

On Wed, Nov 25, 2020 at 8:51 AM Hideyuki Nagase notifications@github.com wrote:

@mucki-at https://github.com/mucki-at , I'm not able to repro this. Does this repro consistently for you or only sometime ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/wslg/issues/119#issuecomment-733825652, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFR6C7MXEWU6IFDTVDERLVLSRUY2DANCNFSM4TVARXBQ .

hideyukn88 commented 4 years ago

@mucki-at , I looked at attached weston.log from you, while I can't be 100% sure, but below can be clue, Below means when apps (notepad in your case) pasted text into Windows's clipboard, mstsc.exe informs Linux side about what formats (say text, html, bitmap...) in Windows' clipboard, so Linux side can pull those if supported, but below shows it has 0 formats in there, thus nothing can be copy from Windows side... I will see if I can have more extensive logging around this.

[12:26:14.475] Client: clipboard format list: numFormats:0 [12:26:14.475] RDP clipboard_client_format_list (0x7f2810003650) [12:26:14.475] Client: clipboard format list: no formats are supported

spronovo commented 3 years ago

I tried to reproduce this and couldn't either. We've done a lot of changes to the clipboard support and fixes many issues since that was originally open. Resolving for now, please let us know if you are still seeing issue on more recent build.

devcircus commented 3 years ago

Experiencing the same behavior as OP. It is random. Sometimes works, sometimes doesn't. Seems I can get it working if I copy and paste several times in other locations in windows before finally copying and pasting to the gui app I'm using.

hideyukn88 commented 3 years ago

@devcircus , would you please provide weston.log from \mnt\wslg ? it would be helpful if you can capture weston.log right after the issue occurs. thanks!

IvanChepurnyi commented 3 years ago

I have the same issue as OP when try to work with my IDE in Linux, anything I copy from my windows does not get pasted into Linux GUI. Here is a log, seems like it does not work with text/plain mime type with specified charset?

[19:49:54.271] xfixes selection notify event: owner 2097153
[19:49:54.271] our window, skipping
[19:49:55.018] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[19:49:55.031] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[19:49:55.039] selection request, CLIPBOARD, target UTF8_STRING, property XAWT_SELECTION
[19:49:55.040] RDP clipboard_data_source_send (0x7f9690000c90) fd:103, mime-type:"text/plain;charset=utf-8"
[19:49:55.040] RDP clipboard_data_source_send (0x7f9690000c90) specified format (text/plain;charset=utf-8.0.0) is not supported by client

Copying from terminal output works, but from browsers and other rich text sources - does not.

hideyukn88 commented 3 years ago

@IvanChepurnyi , yes, currently "text/plain;charset=utf-8.0.0" is not recognized. it has to be exactly "text/plain;charset=utf-8". would you please let me know what is your IDE software? and also it would be helpful if you can confirmed pasting from Windows works with other Linux app, such as Firefox and gedit? thanks!

IvanChepurnyi commented 3 years ago

I use PHPStorm (IntelliJ IDEA variant) started from Linux and copy from various apps like Notepad, Notepad++, Edge, etc.

The only app from which copy-pasting works the Terminal app. Anything that resembles utf-8 contents seems not working.

I've also installed Firefox on Linux and tried to paste data from Windows, and all works flawlessly; only JetBrains IDE seems to fail.

chiqui3d commented 3 years ago

I still have the same problem, from Windows to any WSL/Ubuntu software or Windows terminal(WSL, CMD and PowerShell) it works perfectly.

But if I copy it from any .log, .txt or software from WSL/Ubuntu it doesn't work in the following situations:

  1. Any Windows software: Works.
  2. Windows terminal:
    • WSL: does not work
    • CMD: does not work
    • PowerShell: doesn't work with right-click, but works with CTRL + V
chiqui3d commented 3 years ago

I also add that I have PHPStorm installed inside WSL and it does not work to paste from the Windows to any PHPStorm file.

Is there no solution for this?

mmachatschek commented 3 years ago

I also have this issue. Here is a dump of the logs produced while trying to do the following:

In Windows -> select text -> Ctrl + C -> in WSLg running app (PHPStorm) -> Ctrl + V Result: Nothing happens

I also found that for Gitkraken it's not working too. Same problem as with PHPStorm.

In Gedit I can paste the content.

weston.log

[12:48:36.408] read 0 (available 65536, mask 0x4)
[12:48:36.408] non-incr transfer complete
[12:48:36.414] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[12:48:36.545] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[12:48:36.555] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[12:48:36.562] selection request, CLIPBOARD, target UTF8_STRING, property XAWT_SELECTION
[12:48:36.563] RDP clipboard_data_source_send (0x7f26a8000b50) fd:81, mime-type:"text/plain;charset=utf-8"
[12:48:36.563] RDP clipboard_data_source_send (0x7f26a8000b50) specified format (text/plain;charset=utf-8.0.0) is not supported by client
[12:48:36.563] read 0 (available 65536, mask 0x4)
[12:48:36.563] non-incr transfer complete
[12:48:36.567] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[12:48:36.699] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[12:48:36.702] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[12:48:36.704] selection request, CLIPBOARD, target UTF8_STRING, property XAWT_SELECTION
[12:48:36.705] RDP clipboard_data_source_send (0x7f26a8000b50) fd:81, mime-type:"text/plain;charset=utf-8"
[12:48:36.705] RDP clipboard_data_source_send (0x7f26a8000b50) specified format (text/plain;charset=utf-8.0.0) is not supported by client
[12:48:36.705] read 0 (available 65536, mask 0x4)
[12:48:36.705] non-incr transfer complete
[12:48:36.707] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
hideyukn88 commented 3 years ago

@mmachatschek , thanks for reportng. I installed PhpStrom (2021.1.2) from JetBrains Toolbox and copied text from Windows notepad and pasted with "Ctrl+v" into PhpStrom, it seems working for me, see "copy test from Windows". Does this happen to you all the time? Also, if you haven't move up to the latest release of WSLg, version 1.0.19, please update and try again, thanks!

image

chiqui3d commented 3 years ago

@hideyukn88, Try copying several lines of text, for example the 3 lines you just typed, and see if it will paste into the editor.

hideyukn88 commented 3 years ago

@chiqui3d , thanks for tips, but I still can't repro. If we can see below error in your weston log. can you locate which has bold number with "not supported by client" error.

[19:49:55.040] RDP clipboard_data_source_send (0x7f9690000c90) specified format (text/plain;charset=utf-8.0.0) is not supported by client

And find matching number entry with "clipboard_client_format_list (0xXXXXXX) allocated", and just above lines shows the supported format. For example, in my case (below), which is working, I would like to see what you have from "clipboard_client_format_list". thanks!

[09:49:44.819] Client: clipboard_client_format_list clipboard format list: numFormats:4 [09:49:44.820] Client: clipboard_client_format_list clipboard formats[0]: formatId:13, formatName:CF_UNICODETEXT [09:49:44.820] Client: clipboard_client_format_list clipboard formats[1]: formatId:16, formatName:CF_LOCALE [09:49:44.820] Client: clipboard_client_format_list clipboard formats[2]: formatId:1, formatName:CF_TEXT [09:49:44.820] Client: clipboard_client_format_list clipboard formats[3]: formatId:7, formatName:CF_OEMTEX [09:49:44.820] Client: clipboard_client_format_list (0x7fffd80015b0) allocated [09:49:44.820] Client: clipboard_client_format_list (0x7fffd80015b0) mine_type:"text/plain;charset=utf-8" [09:49:44.820] RDP clipboard_data_source_publish (0x7fffd80015b0) [09:49:44.820] RDP clipboard_data_source_send (0x7fffd80015b0) fd:79, mime-type:"text/plain;charset=utf-8"

chiqui3d commented 3 years ago

Ok, I just found weston log, and I got the same errors. But this can't be fixed? 90% of what I copy is in that format. With GWSL this didn't happen to me.

[23:03:04.717] RDP clipboard_data_source_publish (0x7fbdd8000c00)
[23:03:04.717] RDP clipboard_data_source_cancel (0x7fbdd8000f60)
[23:03:04.717] RDP clipboard_data_source_send (0x7fbdd8000c00) fd:80, mime-type:"text/html"
[23:03:04.717] RDP clipboard_data_source_send (0x7fbdd8000c00) request index:3 formatId:49381 Client side Registered Clipboard Format
[23:03:04.717] RDP clipboard_set_selection (base:0x7fbdd8000c00}
[23:03:04.717] RDP clipboard_data_source_unref (0x7fbdd8000f60): refcount:0
[23:03:04.761] Client: clipboard_client_format_data_response (0x7fbdd8000c00) flags:2, dataLen:0
[23:03:04.761] RDP clipboard_data_source_unref (0x7fbdd8000c00): refcount:1
[23:03:07.365] xfixes selection notify event: owner 2097153
[23:03:07.365] our window, skipping
[23:03:07.592] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[23:03:07.643] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[23:03:07.680] selection request, CLIPBOARD, target UTF8_STRING, property XAWT_SELECTION
[23:03:07.680] RDP clipboard_data_source_send (0x7fbdd8000c00) fd:80, mime-type:"text/plain;charset=utf-8"
[23:03:07.680] RDP clipboard_data_source_send (0x7fbdd8000c00) specified format (text/plain;charset=utf-8.0.0) is not supported by client
[23:03:07.680] read 0 (available 65536, mask 0x4)
[23:03:07.680] non-incr transfer complete
[23:03:07.685] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
hideyukn88 commented 3 years ago

@chiqui3d , thanks for checking, can you share entire weston.log ? or at least until where "clipboard_client_format_list" ?

chiqui3d commented 3 years ago

Ok, https://pastebin.com/bSzt80Y5

hideyukn88 commented 3 years ago

Thank you very much, below is what I need. What's happening here is, Windows side propagates both plain text and HTML format as available data format, and Linux side queried HTML format first, then plain text next against same data source, and this second query is failing. I will look into corresponding code path for this scenario, thanks!

[00:08:38.767] Client: clipboard_client_format_list clipboard format list: numFormats:5 [00:08:38.767] Client: clipboard_client_format_list clipboard formats[0]: formatId:49381, formatName:HTML Format [00:08:38.767] Client: clipboard_client_format_list clipboard formats[1]: formatId:13, formatName:CF_UNICODETEXT [00:08:38.767] Client: clipboard_client_format_list clipboard formats[2]: formatId:16, formatName:CF_LOCALE [00:08:38.767] Client: clipboard_client_format_list clipboard formats[3]: formatId:1, formatName:CF_TEXT [00:08:38.767] Client: clipboard_client_format_list clipboard formats[4]: formatId:7, formatName:CF_OEMTEX [00:08:38.767] Client: clipboard_client_format_list (0x7fbdd8000bf0) allocated [00:08:38.767] Client: clipboard_client_format_list (0x7fbdd8000bf0) mine_type:"text/html" [00:08:38.767] Client: clipboard_client_format_list (0x7fbdd8000bf0) mine_type:"text/plain;charset=utf-8" [00:08:38.767] RDP clipboard_data_source_publish (0x7fbdd8000bf0) [00:08:38.767] RDP clipboard_data_source_cancel (0x7fbdd8000d50) [00:08:38.767] RDP clipboard_data_source_send (0x7fbdd8000bf0) fd:80, mime-type:"text/html" [00:08:38.767] RDP clipboard_data_source_send (0x7fbdd8000bf0) request index:3 formatId:49381 Client side Registered Clipboard Format [00:08:38.767] RDP clipboard_set_selection (base:0x7fbdd8000bf0} [00:08:38.767] RDP clipboard_data_source_unref (0x7fbdd8000d50): refcount:0 [00:08:38.796] Client: clipboard_client_format_data_response (0x7fbdd8000bf0) flags:2, dataLen:0 [00:08:38.796] RDP clipboard_data_source_unref (0x7fbdd8000bf0): refcount:1 [00:08:38.817] xfixes selection notify event: owner 2097153 [00:08:38.817] our window, skipping [00:08:40.299] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION [00:08:40.348] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION [00:08:40.363] selection request, CLIPBOARD, target UTF8_STRING, property XAWT_SELECTION [00:08:40.364] RDP clipboard_data_source_send (0x7fbdd8000bf0) fd:80, mime-type:"text/plain;charset=utf-8" [00:08:40.364] RDP clipboard_data_source_send (0x7fbdd8000bf0) specified format (text/plain;charset=utf-8.0.0) is not supported by client

NorseJedi commented 3 years ago

I experience the same issue, both with PhpStorm and Google Chrome running in WSL.

I also experience issues with norwegian characters ("æ ø å Æ Ø Å") being pasted as "æ ø Ã¥ Æ Ø Ã…" into Windows. Let me know if you'd prefer I post a separate issue on that.

My weston.log is here: https://pastebin.com/VX7R2wtB

hideyukn88 commented 3 years ago

@ensnared , I think your case is tracked by https://github.com/microsoft/wslg/issues/20.

hideyukn88 commented 3 years ago

@chiqui3d , would you please let me know what Windows application did you use to "copy" ?

In your case, actually the problem is, despite Windows side reports it supports both HTML and plain text, but when Linux side queried the HTML data, the response from Windows side is FAIL (= flags: 2 in below log message), thus following request of plain text is failed too (since we marked this data source invalid)

[00:08:38.796] Client: clipboard_client_format_data_response (0x7fbdd8000bf0) flags:2, dataLen:0

I tried same with Windows version of Firefox, copying simple text from web page, then it reports HTML and plain text as available formats and Linux quires HTML first, and succeeded, then query plain text, and it can successfully paste the text into PhpStrom, thus I would like to know what application did you use to copy at Windows side. Thanks!

[18:01:14.654] Client: clipboard_client_format_list clipboard format list: numFormats:9 [18:01:14.654] Client: clipboard_client_format_list clipboard formats[0]: formatId:49679, formatName:text/html [18:01:14.654] Client: clipboard_client_format_list clipboard formats[1]: formatId:49453, formatName:HTML Format [18:01:14.654] Client: clipboard_client_format_list clipboard formats[2]: formatId:49903, formatName:text/_moz_htmlco [18:01:14.654] Client: clipboard_client_format_list clipboard formats[3]: formatId:50394, formatName:text/_moz_htmlin [18:01:14.654] Client: clipboard_client_format_list clipboard formats[4]: formatId:13, formatName:CF_UNICODETEXT [18:01:14.654] Client: clipboard_client_format_list clipboard formats[5]: formatId:1, formatName:CF_TEXT [18:01:14.654] Client: clipboard_client_format_list clipboard formats[6]: formatId:50135, formatName:text/x-moz-url-p [18:01:14.654] Client: clipboard_client_format_list clipboard formats[7]: formatId:16, formatName:CF_LOCALE [18:01:14.654] Client: clipboard_client_format_list clipboard formats[8]: formatId:7, formatName:CF_OEMTEX [18:01:14.654] Client: clipboard_client_format_list (0x7fffd8001f70) allocated [18:01:14.654] Client: clipboard_client_format_list (0x7fffd8001f70) mine_type:"text/html" index:3 formatId:49453 [18:01:14.654] Client: clipboard_client_format_list (0x7fffd8001f70) mine_type:"text/plain;charset=utf-8" index:0 formatId:1 [18:01:14.654] RDP clipboard_data_source_publish (0x7fffd8001f70) [18:01:14.655] RDP clipboard_data_source_cancel (0x7fffd8001d50) [18:01:14.655] RDP clipboard_data_source_send (0x7fffd8001f70) fd:71, mime-type:"text/html" [18:01:14.655] RDP clipboard_data_source_send (0x7fffd8001f70) request "text/html" index:3 formatId:49453 Client side Registered Clipboard Format [18:01:14.655] RDP clipboard_set_selection (base:0x7fffd8001f70} [18:01:14.655] RDP clipboard_data_source_unref (0x7fffd8001d50): refcount:0 [18:01:14.704] Client: clipboard_client_format_data_response (0x7fffd8001f70) flags:1, dataLen:1099 [18:01:14.705] RDP clipboard_data_source_write (0x7fffd8001f70) write completed (930 bytes) [18:01:14.705] RDP clipboard_data_source_unref (0x7fffd8001f70): refcount:1 [18:01:19.472] RDP clipboard_data_source_send (0x7fffd8001f70) fd:71, mime-type:"text/plain;charset=utf-8" [18:01:19.472] RDP clipboard_data_source_send (0x7fffd8001f70) request "text/plain;charset=utf-8" index:0 formatId:1 CF_TEXT [18:01:19.489] Client: clipboard_client_format_data_response (0x7fffd8001f70) flags:1, dataLen:58 [18:01:19.489] RDP clipboard_data_source_write (0x7fffd8001f70) write completed (57 bytes) [18:01:19.489] RDP clipboard_data_source_unref (0x7fffd8001f70): refcount:1

chiqui3d commented 3 years ago

Hello, I'm doing it with Chrome

hideyukn88 commented 3 years ago

@chiqui3d , thanks, I still can't reproduce the issue locally. On google chrome (Windows version), highlight the text (below), then Ctrl+c, now switch to PhpStrom, Ctrl+v, it's working fine for me.

image

Hoffs commented 3 years ago

I'm experiencing this issue as well when yanking from Neovim and then trying to paste inside Alacritty terminal.

Same error as for others:

[18:17:06.871] RDP clipboard_data_source_send (0x7f0d6c000ae0) fd:89, mime-type:"text/plain;charset=utf-8"
[18:17:06.871] RDP clipboard_data_source_send (0x7f0d6c000ae0) specified format (text/plain;charset=utf-8.0.0) is not supported by client

Complete log from time of yank to paste:

[18:18:58.348] Client: clipboard_client_format_list clipboard format list: numFormats:4
[18:18:58.348] Client: clipboard_client_format_list clipboard formats[0]: formatId:13, formatName:CF_UNICODETEXT
[18:18:58.348] Client: clipboard_client_format_list clipboard formats[1]: formatId:16, formatName:CF_LOCALE
[18:18:58.348] Client: clipboard_client_format_list clipboard formats[2]: formatId:1, formatName:CF_TEXT
[18:18:58.348] Client: clipboard_client_format_list clipboard formats[3]: formatId:7, formatName:CF_OEMTEX
[18:18:58.348] Client: clipboard_client_format_list (0x7f0d6c000d00) allocated
[18:18:58.348] Client: clipboard_client_format_list (0x7f0d6c000d00) mine_type:"text/plain;charset=utf-8"
[18:18:58.348] RDP clipboard_data_source_publish (0x7f0d6c000d00)
[18:18:58.348] RDP clipboard_data_source_send (0x7f0d6c000d00) fd:90, mime-type:"text/plain;charset=utf-8"
[18:18:58.348] RDP clipboard_data_source_send (0x7f0d6c000d00) request index:0 formatId:1 CF_TEXT
[18:18:58.348] RDP clipboard_set_selection (base:0x7f0d6c000d00}
[18:18:58.349] Client: clipboard_client_format_data_response (0x7f0d6c000d00) flags:2, dataLen:0
[18:18:58.349] RDP clipboard_data_source_unref (0x7f0d6c000d00): refcount:1
[18:18:59.721] RDP clipboard_data_source_send (0x7f0d6c000d00) fd:89, mime-type:"text/plain;charset=utf-8"
[18:18:59.721] RDP clipboard_data_source_send (0x7f0d6c000d00) specified format (text/plain;charset=utf-8.0.0) is not supported by client

I can paste yanked text in Windows without issues, but not inside Alacritty (which is running using wslg). Also as others mentioned, sometimes it works right away, but it could be due to some other inputs.

I am using Neovim nightly with win32yank to directly integrate with windows clipboard: https://github.com/neovim/neovim/wiki/FAQ#how-to-use-the-windows-clipboard-from-wsl

I was able to reproduce it everytime by doing following:

This was done inside Debian 10.9

WSLg ( x86_64 ): 1.0.17+3.Branch.master.Sha.a526dfd5ad03d126bb2d8c528f6c3563e86a40da
Mariner: VERSION="1.0.20210224"
FreeRDP: e4a2fc2053bd8c5f99455fcd08ffee7e5591567a
weston: fd961f5cd116c9358d82ce94d139c1578e21bd00
pulseaudio: 2f0f0b8c3872780f15e275fc12899f4564f01bd5

kernel: 5.10.16.3-microsoft-standard-WSL2

Also for comparison, executing same sequence of events (except Alacritty) purely inside Windows Terminal works perfectly fine.

chiqui3d commented 3 years ago

Sorry for the delay, it's true that sometimes it works, but other times it doesn't work for me, it does some strange things that I don't quite understand the behaviour, it would be ideal if it could support copy and paste in any format.

hideyukn88 commented 3 years ago

Hi, thanks for all people who reporting this issue. I would like to hear from anyone who encounter this issue if....

1: Do you install any third party clipboard manager on Windows ? 2: Do you enable or disable clipboard history on Windows ? (see below settings) 3: Do you enable or disable clipboard sync'ing with other device ? (see below settings)

Thanks!

image

Hoffs commented 3 years ago
  1. Don't think so,
  2. Enabled
  3. Disabled
dan-dekel commented 3 years ago

Experiencing the same issue with VSCode and Jetbrains rider opened via wslg

  1. Nope
  2. Enabled
  3. Disabled
IvanChepurnyi commented 3 years ago
  1. No
  2. Disabled
  3. Disabled
Matsemann commented 3 years ago
  1. no
  2. disabled
  3. disabled

worked just a few days ago here. Now my workaround is echo "test" | xclip -selection clipboard to get it in, but a bit burdensome. Or just have a shared file on both systems I paste into

But sometimes it works, and then it stops working. A wsl --shutdown and it works for a while.

cpbotha commented 3 years ago

After pasting into the GUI app breaks (in my case that's Emacs), for a while I can work around it by first pasting into Windows Terminal, then copying again from there to paste into Emacs.

However, after some more use, this starts to break with a new kind of weston.log error report (see the "still inflight" and "outstanding RDP data request"). It does not help to restart the GUI app in question.

[07:12:53.495] Client: clipboard_client_format_list clipboard format list: numFormats:4
[07:12:53.495] Client: clipboard_client_format_list clipboard formats[0]: formatId:13, formatName:CF_UNICODETEXT
[07:12:53.495] Client: clipboard_client_format_list clipboard formats[1]: formatId:16, formatName:CF_LOCALE
[07:12:53.495] Client: clipboard_client_format_list clipboard formats[2]: formatId:1, formatName:CF_TEXT
[07:12:53.495] Client: clipboard_client_format_list clipboard formats[3]: formatId:7, formatName:CF_OEMTEX
[07:12:53.495] Client: clipboard_client_format_list (0x7f3d88000e70) allocated
[07:12:53.495] Client: clipboard_client_format_list (0x7f3d88000e70) mine_type:"text/plain;charset=utf-8"
[07:12:53.495] RDP clipboard_data_source_publish (0x7f3d88000e70)
[07:12:53.495] RDP clipboard_data_source_cancel (0x7f3d88001050)
[07:12:53.495] RDP clipboard_data_source_send (0x7f3d88000e70) fd:102, mime-type:"text/plain;charset=utf-8"
[07:12:53.495] RDP clipboard_data_source_send (0x7f3d88000e70) request index:0 formatId:1 CF_TEXT
[07:12:53.495] RDP clipboard_set_selection (base:0x7f3d88000e70}
[07:12:53.495] RDP clipboard_data_source_unref (0x7f3d88001050): refcount:0
[07:12:53.496] Client: clipboard_client_format_list clipboard format list: numFormats:4
[07:12:53.496] Client: clipboard_client_format_list clipboard formats[0]: formatId:13, formatName:CF_UNICODETEXT
[07:12:53.496] Client: clipboard_client_format_list clipboard formats[1]: formatId:16, formatName:CF_LOCALE
[07:12:53.496] Client: clipboard_client_format_list clipboard formats[2]: formatId:1, formatName:CF_TEXT
[07:12:53.496] Client: clipboard_client_format_list clipboard formats[3]: formatId:7, formatName:CF_OEMTEX
[07:12:53.496] Client: clipboard_client_format_list (0x7f3d88001050) allocated
[07:12:53.496] Client: clipboard_client_format_list (0x7f3d88001050) mine_type:"text/plain;charset=utf-8"
[07:12:53.496] RDP clipboard_data_source_publish (0x7f3d88001050)
[07:12:53.496] RDP clipboard_data_source_cancel (0x7f3d88000e70)
[07:12:53.496] RDP clipboard_data_source_cancel (0x7f3d88000e70): still inflight
[07:12:53.496] RDP clipboard_data_source_send (0x7f3d88001050) fd:106, mime-type:"text/plain;charset=utf-8"
[07:12:53.496]

RDP clipboard_data_source_send (0x7f3d88001050) vs (0x7f3d88000e70): outstanding RDP data request (client to server)

[07:12:53.496] RDP clipboard_set_selection (base:0x7f3d88001050}
[07:12:53.496] RDP clipboard_data_source_unref (0x7f3d88000e70): refcount:1
[07:12:53.498] Client: clipboard_client_format_data_response (0x7f3d88000e70) flags:1, dataLen:68
[07:12:53.498] RDP clipboard_data_source_unref (0x7f3d88000e70): refcount:0
[07:12:55.095] selection request, CLIPBOARD, target UTF8_STRING, property _EMACS_TMP_
[07:12:55.095] outstanding selection exist
[07:12:55.095] xfixes selection notify event: owner 2097153
[07:12:55.095] our window, skipping
eliezedeck commented 3 years ago

It works for me initially (freshly started) or after reboot, then after a while (multiple computer Sleep, various apps used in the mean-time and one wsl --shutdown to save memory) it stopped working.

UPDATE

As a work-around until a fix, may be a way to restart some service / process or anything in WSL to reset the clipboard feature.

guest777 commented 3 years ago

Same issue here, even after update to the latest preview build.

OS Name: Microsoft Windows 10 Pro OS Version: 10.0.21382 N/A Build 21382

versions.txt, weston.log attached versions.txt weston.log

Clipboard settings: Clipboard_copy

cpbotha commented 3 years ago

Was going great for about half an hour with Emacs, about three to four successful pastes from Edge on Windows into Emacs on X, and then it stopped working (as usual).

I have attached my full weston.log, but when the pasting breaks, it's again the outstanding RDP data request repeating:

RDP clipboard_data_source_send (0x7f94a0000b90) vs (0x7f94a0000ec0): outstanding RDP data request (client to server)

The destination address remains the same, the source address increases every second time (or so).

weston.log

cpbotha commented 3 years ago

I have just also tested this with a Wayland app that does NOT go through XWayland, e.g. gedit on Ubuntu 20.04. (I first tested with a build of the pgtk - nativecomp branch of Emacs in https://github.com/flatwhatson/emacs but rather chose gedit 3.36.2 as a more easily reproducible case)

I can copy text in gedit and paste in a Windows app. I can NOT copy in a Windows app and then paste into gedit (nothing gets pasted).

Perhaps more interestingly, even wl-paste -t text outputs nothing, so somehow the copy from the windows app (Edge in my case) is not correctly transferred to wayland. When I copy something from a Wayland app (gedit), wl-paste -t does output that exact copied text. @hideyukn88 Maybe this stripped-down wl-paste example can reproduce on your side?

This is the relevant error message in weston.log (both for gedit and wl-paste):

[11:11:45.971] Client: ClientGetAppidReq: WindowId:0x3e does not have appId, or not top level window.
[11:11:46.970] RDP clipboard_data_source_accept (base:0x7f5c64000b20) mime-type:"text/plain;charset=utf-8"
[11:11:46.970] RDP clipboard_data_source_send (0x7f5c64000b20) specified format "text/plain;charset=utf-8" index:0 formatId:0 is not supported by client

P.S. I just shutdown wsl and started over. I could paste successfully twice from Edge to gedit on wayland, and the third time stopped working.

Here is the log from just after startup:

[11:27:10.035] Client: LanguageImeInfo: ProfileType: 2 (TF_PROFILETYPE_KEYBOARDLAYOUT)
[11:27:10.035] Client: LanguageImeInfo: LanguageID: 0x409
[11:27:10.035] Client: LanguageImeInfo: LanguageProfileCLSID: GUID_NULL
[11:27:10.035] Client: LanguageImeInfo: ProfileGUID: GUID_NULL
[11:27:10.035] Client: LanguageImeInfo: KeyboardLayout: 0xa0010409
[11:27:19.395] RDP clipboard_data_source_accept (base:0x7fd814000cb0) mime-type:"text/plain;charset=utf-8"
[11:27:31.725] RDP clipboard_data_source_accept (base:0x7fd814000b60) mime-type:"text/plain;charset=utf-8"
[11:27:39.257] RDP clipboard_data_source_accept (base:0x7fd814000ec0) mime-type:"text/plain;charset=utf-8"
[11:27:39.257] RDP clipboard_data_source_send (0x7fd814000ec0) specified format "text/plain;charset=utf-8" index:0 formatId:0 is not supported by client
[11:27:43.508] RDP clipboard_data_source_accept (base:0x7fd814000ec0) mime-type:"text/plain;charset=utf-8"
[11:27:48.151] RDP clipboard_data_source_accept (base:0x7fd814000ab0) mime-type:"text/plain;charset=utf-8"
[11:27:48.151] RDP clipboard_data_source_send (0x7fd814000ab0) specified format "text/plain;charset=utf-8" index:0 formatId:0 is not supported by client

P.P.S. I repeated the experiment, copying from Edge and then running wl-paste -t text in Windows terminal. Works the first two times, and then stops working the third. I copied the first paragraph of this comment (try 1), then the third paragraph starting with "perhaps" (try 2), and then the paragraph starting with "P.S." (try 3, did NOT work).

Log from just after startup:

[11:30:22.084] Audio sink thread: connection successful on socket (97).
[11:30:22.084] RDP Sink version (1 - 1)
[11:30:59.501] RDP clipboard_data_source_send (0x7f557c000d30) specified format "text/plain;charset=utf-8" index:0 formatId:0 is not supported by client

P.P.P.S. I continued with these experiments. When docker for desktop is running with its WSL2 backend, my copy paste breaks quite soon. Without docker for desktop, and hence no additional WSL2 instances but my main instance, copy paste continues working for many more tries.

Is it possible that the additional WSLg system distro instances that are started for each running WSL instance could be interfering with each other?

ThaDaVos commented 3 years ago

I am having the same issue as the people above sometimes - it's random, one thing I noticed which fixes it for my, is selecting the text, copying it, deselecting it, selecting it again and copying again (sometimes pressing CTRL + C multiple times helps too) - then I am able to past it to either side.

I first thought it had something to do with my Dual-GPU/Dual-Monitor setup - also, wsl --shutdown is no option for me, or at least was, as I get greeted with a GSOD (Green Screen of Dead) right after entering the command

eliezedeck commented 3 years ago

I'm not sure if it is related, but I use Ditto clipboard manager. Sometimes when I copy some text from Windows apps, the GUI apps on WSL2 will crash immediately, all of them.

UPDATE: Not, it's not related to Ditto. I have uninstalled it and been running without it for several days now, and pasting into WSLg still fails every now and then.

eliezedeck commented 3 years ago

Been trying the v1.0.23 pre-release, pasting still fails after a while 😔. I have noticed that it mostly happens when I use WebStorm and pasting around its terminal; once it fails, it fails for ALL applications (gedit, firefox, etc...)

hideyukn88 commented 3 years ago

@eliezedeck and all others, thank you very much for trying out patiently. Currently, as we understand, this is caused by Windows is failing to respond with clipboard data after WSLg requested (even though there seems no fault at WSLg side), and we don't know yet why Windows is failing, but one issues with WSLg is, once it entered failed state, it remains failed state forever. We are experimenting some re-try logic to request data again or reset, once this is confirmed it does help, we will update here, thanks for trying out WSLg and helping us!

Hoffs commented 3 years ago

As others mentioned, I also noticed WSLg GUI application crashing when just copying things in Windows. E.g. copy some text from regular Notepad and that might crash a WSLg application. Here's a weston.log with the failed assert:

[13:54:48.399]
RDP clipboard_data_source_send (0x7fdae4000ea0) vs (0x7fdae4000c80): outstanding RDP data request (client to server)
weston: ../libweston/backend-rdp/rdpclip.c:887: clipboard_data_source_cancel: Assertion `source->event_source == NULL' failed.

which seems to point to: https://github.com/microsoft/weston-mirror/blob/43741db009c7f5af1ae2fe61dd1eb7a0508b7f3d/libweston/backend-rdp/rdpclip.c#L887

hideyukn88 commented 3 years ago

@Hoffs, thanks, yes, we addressed that particular issue in WSLg 1.0.23, thanks!

eliezedeck commented 3 years ago

@hideyukn88 @Hoffs I'm currently on v1.0.24, which I would suppose already contains the fixes in 1.0.23. I copied a text from the URL bar from Google Chrome on Windows, and all my IDE and other WSLg windows disappeared/crashed.

So, copying text from Windows still can cause crashes in v1.0.24; regression?

However, I did not reach a point where the copying itself failed yet.

hideyukn88 commented 3 years ago

@eliezedeck, thanks for trying out WSLg 1.0.24. Would you please check /mnt/wslg/weston.log to see if there is any error or assert logged? Here is what I tried by myself.

1: Open https://www.microsoft.com/EN-US/microsoft-365/buy/compare-all-microsoft-365-products with Google-Chrome on Windows. 2: And select the URL text at URL bar and right click then copy. 3: Open Kate (it is X11 app) on WSLg and paste into, and paste works correctly. 4: Open gedit (gedit works in wayland (not X11) mode in WSLg) and paste into and it works correctly too.

eliezedeck commented 3 years ago

@hideyukn88 I wanted to send a weston.log indeed but I didn't know its location so I didn't. So, here I'm showing what I had around the time the crash happened. I don't know if something is useful there or not.

[17:52:42.664] rdp_audio_server_activated: 1 audio formats supported.
[17:52:42.664]  [0] - Format(WAVE_FORMAT_PCM) - Bits(16), Channels(2), Frequency(44100)
[17:52:42.664] RDPAudio - Agreed on format 0.
[17:52:42.664] rdp_audio_server_activated: bytesPerFrame:4, latency:5
[17:52:42.664] Pulse Audio Sink listener socket on /mnt/wslg/PulseAudioRDPSink
[17:52:42.664] Audio sink thread: Listening for audio connection.
[17:57:42.564] rdp_rail_idle_handler is called on peerCtx:0x5651d42a3d10
[17:59:48.297] Spawned Xwayland server, pid 2488
[17:59:49.782] xfixes version: 5.0
[17:59:49.788] created wm, root 586
[17:59:49.788] xfixes selection notify event: owner 2097153
[17:59:49.788] our window, skipping
[17:59:50.305] rdp_rail_wake_handler is called on peerCtx:0x5651d42a3d10
[17:59:50.305] app_list_monitor_thread: loadIconEvent is signalled. sublime_merge
[17:59:50.306] app_list_monitor_thread: entry 0x7fad48045940, image 0x7fad48110510
[17:59:50.306] Client: ClientGetAppidReq: pid:2485 appId:sublime_merge
[17:59:51.272] !!!cursor role is added after creation - WindowId:0x3
[18:00:05.351] Client: LanguageImeInfo: ProfileType: 2 (TF_PROFILETYPE_KEYBOARDLAYOUT)
[18:00:05.351] Client: LanguageImeInfo: LanguageID: 0x40c
[18:00:05.351] Client: LanguageImeInfo: LanguageProfileCLSID: GUID_NULL
[18:00:05.351] Client: LanguageImeInfo: ProfileGUID: GUID_NULL
[18:00:05.351] Client: LanguageImeInfo: KeyboardLayout: 0x40c
[18:00:05.351] convert_rdp_keyboard_to_xkb_rule_names: matching layout=fr variant=(null)
[18:00:05.369] xfixes selection notify event: owner 2097153
[18:00:05.369] our window, skipping
[18:00:14.364] set_position_from_xwayland: XWM 1600, 880; geometry 32, 32; view 1568, 848
[18:00:14.397] Client: ClientGetAppidReq: pid:2537 appId:jetbrains-webstorm
[18:00:20.783] set_position_from_xwayland: XWM 500, 618; geometry 32, 32; view 468, 586
[18:00:20.793] set_position_from_xwayland: XWM 1454, 405; geometry 32, 32; view 1422, 373
[18:00:20.913] Client: ClientGetAppidReq: pid:2537 appId:jetbrains-webstorm
[18:00:20.914] Client: ClientGetAppidReq: pid:2537 appId:jetbrains-webstorm
[18:00:20.938] !!!cursor role is added after creation - WindowId:0x1
[18:00:20.938] cursor surface already exists old 0x5651d4605800 vs new 0x5651d45edd30
[18:00:32.702] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[18:00:32.769] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[18:00:32.779] selection request, CLIPBOARD, target UTF8_STRING, property XAWT_SELECTION
[18:00:32.780] read 8 (available 65536, mask 0x5)
[18:00:32.780] nothing happened, buffered the bytes
[18:00:32.780] read 0 (available 131064, mask 0x4)
[18:00:32.780] non-incr transfer complete
[18:00:32.807] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[18:00:37.663] xfixes selection notify event: owner 2097153
[18:00:37.663] our window, skipping
[18:00:38.530] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[18:00:38.538] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[18:00:38.542] selection request, CLIPBOARD, target UTF8_STRING, property XAWT_SELECTION
[18:00:38.543] read 10 (available 65536, mask 0x5)
[18:00:38.543] nothing happened, buffered the bytes
[18:00:38.543] read 0 (available 131062, mask 0x4)
[18:00:38.543] non-incr transfer complete
[18:00:38.546] selection request, CLIPBOARD, target TARGETS, property XAWT_SELECTION
[18:00:43.542] xfixes selection notify event: owner 8388616
[18:00:43.548] wrote 7 (chunk size 7) of 7 bytes
[18:00:43.548] transfer complete
[18:00:44.980] wrote 7 (chunk size 7) of 7 bytes
[18:00:44.980] transfer complete
[18:01:34.881] set_position_from_xwayland: XWM 1600, 880; geometry 32, 32; view 1568, 848
[18:01:34.915] Client: ClientGetAppidReq: pid:3111 appId:jetbrains-goland
[18:01:36.510] set_position_from_xwayland: XWM 832, 195; geometry 32, 32; view 800, 163
[18:01:36.688] Client: ClientGetAppidReq: pid:3111 appId:jetbrains-goland
[18:04:49.692] Client: ClientGetAppidReq: WindowId:0x10 does not have appId, or not top level window.
[18:05:14.848] xfixes selection notify event: owner 8388616
[18:05:14.851] wrote 27 (chunk size 27) of 27 bytes
[18:05:14.851] transfer complete
[18:05:18.856] Client: ClientGetAppidReq: WindowId:0x11 does not have appId, or not top level window.
[18:05:20.527] Client: ClientGetAppidReq: WindowId:0x12 does not have appId, or not top level window.
[18:05:44.129] Client: ClientGetAppidReq: WindowId:0x14 does not have appId, or not top level window.
[18:05:46.791] Client: ClientGetAppidReq: WindowId:0x15 does not have appId, or not top level window.
[18:05:57.175] Client: ClientGetAppidReq: WindowId:0x16 does not have appId, or not top level window.
[18:06:07.631] Client: ClientGetAppidReq: WindowId:0x17 is not found.
[18:06:13.706] xfixes selection notify event: owner 8388616
[18:06:13.719] wrote 65 (chunk size 65) of 65 bytes
[18:06:13.719] transfer complete
[18:06:22.202] Client: ClientGetAppidReq: WindowId:0x18 does not have appId, or not top level window.
[18:06:23.980] Client: ClientGetAppidReq: WindowId:0x19 does not have appId, or not top level window.
[18:06:25.697] Client: ClientGetAppidReq: WindowId:0x1a does not have appId, or not top level window.
[18:06:40.695] Client: ClientGetAppidReq: WindowId:0x1c does not have appId, or not top level window.
[18:06:44.881] Client: ClientGetAppidReq: WindowId:0x1d does not have appId, or not top level window.
[18:06:46.940] Client: ClientGetAppidReq: WindowId:0x1e does not have appId, or not top level window.
[18:07:12.625] xfixes selection notify event: owner 8388616
[18:07:12.630] wrote 33 (chunk size 33) of 33 bytes
[18:07:12.630] transfer complete
[18:07:31.834] Client: ClientGetAppidReq: WindowId:0x22 does not have appId, or not top level window.
[18:07:35.801] xfixes selection notify event: owner 8388616
[18:07:35.804] wrote 47 (chunk size 47) of 47 bytes
[18:07:35.804] transfer complete
[18:07:52.303] xfixes selection notify event: owner 8388616
[18:07:52.315] wrote 47 (chunk size 47) of 47 bytes
[18:07:52.316] transfer complete
[18:08:02.314] Client: ClientGetAppidReq: WindowId:0x23 does not have appId, or not top level window.
[18:08:05.243] Client: ClientGetAppidReq: WindowId:0x24 does not have appId, or not top level window.
[18:08:14.043] xfixes selection notify event: owner 8388616
[18:08:14.054] wrote 76 (chunk size 76) of 76 bytes
[18:08:14.054] transfer complete
[18:08:16.235] Client: ClientGetAppidReq: WindowId:0x25 does not have appId, or not top level window.
[18:08:25.510] Client: ClientGetAppidReq: WindowId:0x26 does not have appId, or not top level window.
[18:09:03.296] Client: ClientGetAppidReq: WindowId:0x27 is not found.
[18:09:17.047] Client: ClientGetAppidReq: WindowId:0x28 does not have appId, or not top level window.
[18:09:20.032] Client: ClientGetAppidReq: WindowId:0x29 does not have appId, or not top level window.
[18:09:26.444] Client: ClientGetAppidReq: WindowId:0x2a does not have appId, or not top level window.
[18:09:59.098] Client: ClientGetAppidReq: WindowId:0x2b does not have appId, or not top level window.
[18:10:01.465] Client: ClientGetAppidReq: WindowId:0x2c does not have appId, or not top level window.
[18:10:03.470] Client: ClientGetAppidReq: WindowId:0x2d does not have appId, or not top level window.
[18:10:08.600] Client: ClientGetAppidReq: WindowId:0x2f does not have appId, or not top level window.
[18:10:23.822] Client: ClientGetAppidReq: WindowId:0x30 does not have appId, or not top level window.

I have restarted the IDEs that I was using and so far no crash yet. I think in order to arrive at crash, a lot of things must have already happened and it's difficult to reproduce. I'll make sure I look into the weston.log when/if I get another crash.

eliezedeck commented 3 years ago

@hideyukn88 might be useful for you to know, that I'm developing Go and Web apps using GoLand and WebStorm (both are Jetbrains products) and I have multiple projects open in GoLand (so multiple windows). I copy codes back and forth between the 2 GoLand windows, and sometimes copy around texts from WebStorm too. Sometimes, I would copy stuffs from Chrome and Notepad++ on Windows, and it rarely crashes.

hideyukn88 commented 3 years ago

@eliezedeck, thanks for info. For weston.log, you will need to look for previous instance of weston, have you seen any restart of weston logged?. And would also you please check /mnt/wslg/dumps to see if any core dumps are saved? thanks!

eliezedeck commented 3 years ago

There is a core dump indeed. So, apparently, the logs I sent you earlier didn't contain anything relevant because the dump was taken at 17:52 (on my PC's time) and that particular time has probably thousands of log lines.

@hideyukn88 How can I send to you the core dump and the full logs?

hideyukn88 commented 3 years ago

@eliezedeck , please file feedback using Feedback Hub in Windows, you will need to select category as "Developer Platform" and sub-category as "Windows Subsystem for Linux", and add title of this issue "Cannot copy text into Kate editor, copying text from Kate works fine." and add link to this issue at feedback description, then at "Add more details", you can attach the core dump and full logs, thanks!

eliezedeck commented 3 years ago

@hideyukn88 Done. I sent the report (core dump + logs), I think it has finished uploading the attached files.

https://aka.ms/AAcxvwr