Xpra: Ticket #459: Null character gets added to the end of clipboard contents while copying from MS Windows

Both client and server versions are 0.10.9, as indicated by 'About' window and 'xpra --version'.

So, when I do, for example, Win+R -> type 'notepad' -> Ctrl+A -> Ctrl+C, then on my virtualboxes' Ubuntu 13.10 putty command prompt execute

$ xclip -o -selection clipboard | cat -v

, I get

notepad^@

which seems to me to be the case of off-by-one-error. So, I'm no expert in X protocol, but if saving clipboard contents requires putting length of the contents, could you please just decrement it by one?



Mon, 18 Nov 2013 04:08:01 GMT - Antoine Martin: owner, status changed

Thanks for the report - it's embarrassing that I never spotted this before, despite using the "GTK_Clipboard_Tool.exe" extensively for clipboard testing! (this is not an off-by-one error)

Here is some debugging collected with:

XPRA_CLIPBOARD_DEBUG=1 xpra ...

I am only including client-side logs as the server doesn't do anything clever with this data.


Here's what happens client side on win32:

Doing the same thing from a Linux client:

I don't like blindly truncating the UTF8_STRING on win32 as this is just an encoding and applications may use UTF8 to transfer data that does have null bytes in it, including at the end of the string.. Just as bad to make this workaround conditional on a specific platform.. But since I can't think of a better solution, r4773 does exactly that.

I will backport this to v0.10.x


Mon, 18 Nov 2013 04:13:47 GMT - Antoine Martin: status changed; resolution set

Applied to v0.10.x in r4774. Closing, feel free to re-open if I've missed anything.


Mon, 18 Nov 2013 04:35:24 GMT - AndrewZ:

Thanks for quick reply and specially for backporting :-)


Mon, 18 Nov 2013 04:40:54 GMT - AndrewZ:

Replying to totaam:

I don't like blindly truncating the UTF8_STRING on win32 as this is just an encoding and applications may use UTF8 to transfer data that does have null bytes in it, including at the end of the string.. Just as bad to make this workaround conditional on a specific platform.. But since I can't think of a better solution, r4773 does exactly that.

I'll just put here an advice to report a bug to GTK developers - it's there responsibility from what I've understood.


Mon, 18 Nov 2013 05:27:12 GMT - AndrewZ:

Replying to totaam:

Applied to v0.10.x in r4774. Closing, feel free to re-open if I've missed anything.

Can you please also build it and upload?


Mon, 18 Nov 2013 05:36:04 GMT - AndrewZ:

Replying to AndrewZ:

Replying to totaam:

Applied to v0.10.x in r4774. Closing, feel free to re-open if I've missed anything.

Can you please also build it and upload?

I mean, I know it's Python, but I could not find clipboard_base.py on Windows.


Mon, 18 Nov 2013 06:51:18 GMT - Antoine Martin:

I'll just put here an advice to report a bug to GTK developers - it's their responsibility from what I've understood.

It is, but since they've abandoned GTK2 (no updates for almost 2 years) and seem to ignore bug reports, I won't bother :(

Can you please also build it and upload? I mean, I know it's Python, but I could not find clipboard_base.py on Windows.

py2exe creates a zip file named library.zip which contains all the python bits.


If you cannot wait for the upcoming 0.10.10 release, there are 0.11.0 beta win32 packages with the fix here (and 0.11 is now stable enough for day to day usage - also getting close to a release)


Mon, 18 Nov 2013 06:59:12 GMT - AndrewZ:

Replying to totaam:

It is, but since they've abandoned GTK2 (no updates for almost 2 years) and seem to ignore bug reports, I won't bother :(


Maybe people from MUTTER project could help? Or do they also use GTK3?

If you cannot wait for the upcoming 0.10.10 release, there are 0.11.0 beta win32 packages with the fix here (and 0.11 is now stable enough for day to day usage - also getting close to a release)


Thanks again!


Mon, 18 Nov 2013 09:13:05 GMT - AndrewZ:

Actually 0.11.0 isn't working for me at all. I connect through ssh, then no windows are shown, still plink is running (spawned by Xpra launcher process). Does it require newer beta server than that I see on xpra.org/beta/saucy?


Mon, 18 Nov 2013 09:15:35 GMT - Antoine Martin:

Actually 0.11.0 isn't working for me at all

Oh snap!

Does it require newer beta client than that I see on xpra.org/beta/saucy?

The new client I uploaded was for win32, the saucy beta packages are much older. You should not need a new server to try the new win32 client though.


Mon, 18 Nov 2013 09:18:00 GMT - AndrewZ:

That's bad... Some advice to collect info?


Mon, 18 Nov 2013 09:20:22 GMT - Antoine Martin:

Advice: yes, the usual:

etc..

(in a new ticket please)


Sat, 23 Jan 2021 04:56:11 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/459