https://bugs.kde.org/show_bug.cgi?id=512076
Bug ID: 512076
Summary: Clipboard.SelectionWrite results in repeated data in
clipboard
Classification: Plasma
Product: xdg-desktop-portal-kde
Version First 6.5.1
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
SUMMARY
When calling Clipboard.SelectionWrite, whatever I am writing into the FD will
get repeated in the clipboard (seemingly arbitrarily) many times.
STEPS TO REPRODUCE
1. Call Clipboard.SelectionWrite("ab")
2. Paste inside remote session
OBSERVED RESULT
The clipboard contains "ab" repeated many times (~3k-100k times).
EXPECTED RESULT
The clipboard should contain "ab".
SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 43
KDE Plasma Version: 6.5.1
KDE Frameworks Version: 6.19.0
Qt Version: 6.10.0
xdg-desktop-portal-kde-6.5.2-1 (+ patch
https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/b7f2107d0eb35d2b4cfccf9ffaa91437b88eff0a)
ADDITIONAL INFORMATION
I was unsure if this had anything to do with a missing null-terminator. Here is
some example code I used to test this:
> int written;
> int remaining;
> const char* data;
>
> char s[] = { 97, 98, '\0' };
> remaining = 3;
> data = s;
>
> while (remaining > 0) {
> written = write(fd, data, remaining);
>
> if (written < 0) {
> vlog.error("Error writing to fd: %s", strerror(errno));
> selectionWriteDone(serial, false);
> g_object_unref(fdList);
> close(fd);
> return;
> }
>
> remaining -= written;
> data += written;
> }
>
> if (close(fd) != 0) {
> vlog.error("Failed to close fd: %s", strerror(errno));
> selectionWriteDone(serial, false);
> } else {
> selectionWriteDone(serial, true);
> }
If I include the null-terminator (remaining = 3) and try to paste into Konsole,
I get a Confirm Paste warning with between ~3k and 100k characters of repeated
"ab", and a warning about pasting hidden control characters U+0000. Pasting
with the null character will simply paste "ab" to the terminal.
If I don't include the null-terminator (remaining = 2), I still get the Confirm
Paste warning with ~3-100k characters.
Note that the number of characters printed (~3-100k) will differ between each
paste, and not between every time I write to the clipboard.
--
You are receiving this mail because:
You are watching all bug changes.