#248 last character disappear when pasting from FreeBSD to WinXP

open
nobody
5
2012-11-29
2007-06-14
Anonymous
No

I'm starting rdesktop as:
rdesktop -K -g 95% -a 16 -r clipboard:CLIPBOARD -k en-gb -p - hostname

and there's one character always missing when pasting from FreeBSD to WinXP.

I compiled rdesktop 1.5 with clipboard debugging, and what I get is:
xclip_handle_SelectionNotify: selection=CLIPBOARD, target=STRING, property=_RDESKTOP_CLIPBOARD_TARGET
xclip_send_data_with_convert: target=STRING, size=15
Translating linebreaks before sending data
cliprdr_send_data
CLIPRDR send: type=5, status=1, length=15
cliprdr_send_simple_native_format_announce
cliprdr_send_native_format_announce
CLIPRDR send: type=2, status=0, length=36
CLIPRDR recv: type=3, status=1, length=0

while size and length is 15, the last char is missing, and only 14 are pasted.

Now, I blindly made this patch:
--- cliprdr.c.orig Thu Jun 14 09:48:48 2007
+++ cliprdr.c Thu Jun 14 09:47:23 2007
@@ -107,7 +107,7 @@
cliprdr_send_data(uint8 * data, uint32 length)
{
DEBUG_CLIPBOARD(("cliprdr_send_data\n"));
- cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length);
+ cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length+1);
}

static void

and what I get from debug (pasting not the same text ;):
xclip_handle_SelectionNotify: selection=CLIPBOARD, target=STRING, property=_RDESKTOP_CLIPBOARD_TARGET
xclip_send_data_with_convert: target=STRING, size=4
Translating linebreaks before sending data
cliprdr_send_data
CLIPRDR send: type=5, status=1, length=5
cliprdr_send_simple_native_format_announce
cliprdr_send_native_format_announce
CLIPRDR send: type=2, status=0, length=36
CLIPRDR recv: type=3, status=1, length=0

now size and length differ by one (text was 'test').
but now it pastes correctly and doesn't crash...

my language environment looks like:
LANGUAGE=lt_LT.ISO8859-13
LC_ALL=lt_LT.ISO8859-13
LC_MESSAGES=lt_LT.ISO8859-13
LANG=lt_LT.ISO8859-13
MM_CHARSET=iso-8859-13

no UTF-8...

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I have the same problem.

    My environment is: FreeBSD 6.2, Xorg 7.2, RDesktop 1.5.0 -> Windows Server 2003.

    Would it be possible to fix the bug? I'm here if you need a tester.

    Martin
    martin@horcicka.eu

     
  • Nobody/Anonymous

    Logged In: NO

    default install on FreeBSD does not use libiconv - the configure script does not search for iconv.h in /usr/local/include and the library in /usr/local/lib, where they are installed on FreeBSD. The off by one bug seems to occur in the code path without unicode support.

    workaround: install the libiconv port/package and run the rdesktop configure with

    ./configure CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib

     
  • Nobody/Anonymous

    Logged In: NO

    Yes, the bug exists and is very annoying. Upgrading to 1.6 didn't help. The above patch works randomly on some machines and do not work on other. Please fix it if possible.

     
  • Nobody/Anonymous

    I can confirm building with iconv support corrects this problem entirely.

    $ cd /usr/ports/net/rdesktop
    $ make -DWITH_ICONV install clean