Package: rxvt
Version: 1:2.6.4-9
Severity: normal
Tags: patch

When pasting the X11 selection into Sun's Java implementation,
specifically:

java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

... but probably any Sun implementation and possibly others, the paste
fails to have any effect except that the Sun JVM shared library outputs
this message, or similar, on stderr:

Atom was -6276164

This behavior doesn't happen on the i386 architecture but does on the
amd64 architecture.

The cause is the incorrect size of the elements in the target_list array
passed to XChangeProperty in screen.c.  This has been rectified in the
CVS version of rxvt with the following patch:

http://cvs.sourceforge.net/viewcvs.py/rxvt/rxvt/src/screen.c?r1=1.267&r2=1.268

The check-in comment says:

  Try to deal with systems which don't use an internal Atom
  size of 32 bits more nicely

Although this does indeed make the code nicer, it also makes it correct.
Atom is a 64 bit type in the amd64 architecture but, when passing
XA_ATOM arguments to XChangeProperty, one must use a "format" argument
of 32 but pass an array of 64 bit Atoms to the function.

Well, that's my belief, which I can substantiate with snippets of other
applications which don't suffer from this problem and extracts from
Xlibint.[hc] and ChProp.c from the X distribution as required.

Hopefully reportbug is about to ask me for the filename of my patch for
rxvt-2.6.4.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-2-amd64-k8
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)

Versions of packages rxvt depends on:
ii  base-passwd              3.5.10          Debian base system master password
ii  libc6                    2.3.5-7         GNU C Library: Shared libraries an
ii  libx11-6                 6.8.2.dfsg.1-10 X Window System protocol client li
ii  xlibs                    6.8.2.dfsg.1-10 X Window System client libraries m

rxvt recommends no packages.

-- no debconf information

*********************************************************************************
This email and any attachment is confidential. It may only  be read, copied
 and used by the intended recipient(s). If you are not the intended recipient 
(s), you may not copy, use, distribute, forward, store or disclose this e-mail 
or any attachment. If you are not the intended recipient(s) or have otherwise 
received this e-mail in error, you should destroy it and any attachment and 
notify the sender by reply e-mail or send a message to: [EMAIL PROTECTED]
*********************************************************************************


--- screen.c-2.6.4	2005-11-25 15:37:15.000000000 -0800
+++ screen.c	2005-11-28 23:00:52.000000000 -0800
@@ -3403,14 +3403,6 @@
 
 /* ------------------------------------------------------------------------- */
 /*
- * On some systems, the Atom typedef is 64 bits wide.  We need to have a type
- * that is exactly 32 bits wide, because a format of 64 is not allowed by
- * the X11 protocol.
- */
-typedef CARD32  Atom32;
-
-/* ------------------------------------------------------------------------- */
-/*
  * Respond to a request for our current selection
  * EXT: SelectionRequest
  */
@@ -3419,7 +3411,7 @@
 selection_send(const XSelectionRequestEvent * rq)
 {
     XEvent          ev;
-    Atom32          target_list[4];
+    Atom            target_list[4];
     Atom            target;
     static Atom     xa_targets = None;
     static Atom     xa_compound_text = None;
@@ -3444,13 +3436,12 @@
     ev.xselection.time = rq->time;
 
     if (rq->target == xa_targets) {
-	target_list[0] = (Atom32) xa_targets;
-	target_list[1] = (Atom32) XA_STRING;
-	target_list[2] = (Atom32) xa_text;
-	target_list[3] = (Atom32) xa_compound_text;
+	target_list[0] = xa_targets;
+	target_list[1] = XA_STRING;
+	target_list[2] = xa_text;
+	target_list[3] = xa_compound_text;
 	XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
-			(8 * sizeof(target_list[0])), PropModeReplace,
-			(unsigned char *)target_list,
+			32, PropModeReplace, (unsigned char *)target_list,
 			(sizeof(target_list) / sizeof(target_list[0])));
 	ev.xselection.property = rq->property;
     } else if (rq->target == XA_STRING

Reply via email to