Bug 430339 - Clipboard gets two entries (one truncated) when KRDC client is connected to a VNC server (Krfb)
Summary: Clipboard gets two entries (one truncated) when KRDC client is connected to a...
Status: REPORTED
Alias: None
Product: krdc
Classification: Applications
Component: VNC (show other bugs)
Version: 20.08
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Urs Wolfer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-13 14:03 UTC by David Warner
Modified: 2021-05-13 03:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Clipboard manager screenshot (60.73 KB, image/png)
2020-12-13 14:03 UTC, David Warner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Warner 2020-12-13 14:03:09 UTC
Created attachment 134051 [details]
Clipboard manager screenshot

SUMMARY
When KRDC is connected to a VNC server (running Krfb), copying text with multibyte characters results in 2 clipboard entries, the topmost truncated.

STEPS TO REPRODUCE
1. Connect to a Krfb server using KRDC.
2. Copy some text containing multibyte characters.
3. Paste the text on the server (using the KRDC window).
4. Paste the text on the client.
5. View the clipboard manager.

OBSERVED RESULT
(3) The text is not truncated.
(4) The text is truncated.
(5) 2 copies of the text appear, one truncated.

EXPECTED RESULT
(3) The text is not truncated.
(4) The text is not truncated.
(5) 1 copy of the text should appear.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux 5.9.14-200.fc33.x86_64 x86_64
KDE Plasma Version: 5.20.4
KDE Frameworks Version: 5.76.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
RFC 6143* states that 'There is no way to transfer text outside the Latin-1 character set.', but in practice this works for me when using KRDC connected to Krfb; it is the client that ends up having a problem.

The length of the second clipboard entry seems to be the length of the string as if each character were 1 byte. For example,
五十音, "Fifty Sounds"
starts with three 3-byte characters, while the remaining 16 characters are 1-byte, giving a total of 19 characters and 25 bytes. The extra entry is shortened by 6 characters:
五十音, "Fifty S

A slightly different problem manifests when copying a file to the clipboard - again, two entries are present, the first being the file and the second being the path to the file, e.g. 'file:///home/david/2020-12-14 Clipboard duplicate'. Trying to paste the file brings up the 'Filename for clipboard content:' dialog.

* https://tools.ietf.org/html/rfc6143

This doesn't seem to happen under Wayland.
Comment 1 Philipp Maierhöfer 2021-05-11 19:04:24 UTC
I can confirm this (on Tumbleweed and neon-user-20210506-0945 using X) and I'm in particular affected by the copy&paste problem. Copying a file in Dolphin and pasting it opens the "filename for clipboard content" dialogue (client to client copy not involving the server). Entering a file name creates a text file with the URL of the copied file instead of the file itself. Yes, there are two entries in Klipper: the file and its URL. But choosing the file explicitly doesn't work either, the URL always stays in the first place.

Not only KDE applications are affected, but also e.g. LibreOffice (formulas can't be pasted anymore). And umlauts are pasted with the wrong encoding.

I'm connecting to a Raspberry Pi 4 running Ubuntu 21.04 and Kfrb via VNC. Client keyboard layout is en_US, server de_DE. Other than in https://bugs.kde.org/show_bug.cgi?id=327311 and https://bugs.kde.org/show_bug.cgi?id=420177, the keyboard layout on the client is not changed when the connection is established.

As soon as KRDC is disconnected, everything is back to normal.
Comment 2 David Warner 2021-05-13 03:20:58 UTC
The behaviour has changed for me recently, possibly in KDE Plasma 5.21 - I still get 2 clipboard entries, but instead of 1 being truncated like before, the >1 byte characters are replaced with '?' (e.g. '五十音, "Fifty Sounds"' -> '???, "Fifty Sounds"').

As Philipp Maierhöfer notes, closing KRDC will stop this happening. Alternatively, clearing the clipboard history while KRDC is running will break copy/paste in and out of KRDC but avoid the double entry problem elsewhere.