Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Apr 2011 22:56:23 GMT
From:      Marcin Cieslak <saper@saper.info>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        thierry@FreeBSD.org
Subject:   ports/156509: [PATCH] x11/rxvt-unicode: fix BadAtom in X_ChangeProperty when pasting from some clients
Message-ID:  <201104192256.p3JMuNSH071992@radziecki.saper.info>
Resent-Message-ID: <201104192300.p3JN0LGq081302@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         156509
>Category:       ports
>Synopsis:       [PATCH] x11/rxvt-unicode: fix BadAtom in X_ChangeProperty when pasting from some clients
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 19 23:00:21 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Marcin Cieslak
>Release:        FreeBSD 9.0-CURRENT amd64
>Organization:
http://saper.info
>Environment:
System: FreeBSD radziecki.saper.info 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r219785M: Mon Mar 21 11:40:40 CET
>Description:

I have found a bug in rxvt derivatives:

https://sourceforge.net/tracker/?func=detail&aid=3289852&group_id=221&atid=100221

http://thread.gmane.org/gmane.comp.terminal-emulators.rxvt-unicode.general/958


Added file(s):
- files/patch-src::screen.C

Port maintainer (thierry@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:

Try to paste some text from rxvt-unicode into example1 client from:

http://michael.toren.net/mirrors/doc/X-copy+paste.txt

you should get:

urxvt: An X Error occurred, trying to continue after report.
urxvt: X Error of failed request:  BadAtom (invalid Atom parameter)
urxvt: Major opcode of failed request:  18
urxvt: (which is X_ChangeProperty)
urxvt: Atom id in failed request:  0x0
urxvt: Serial number of failed request:  347

in a shell that is parent to rxvt-unicode (where
rxvt-unicode was started from).

>Fix:

--- rxvt-unicode-9.10_1.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/x11/rxvt-unicode.orig/files/patch-src::screen.C /usr/ports/x11/rxvt-unicode/files/patch-src::screen.C
--- /usr/ports/x11/rxvt-unicode.orig/files/patch-src::screen.C	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/x11/rxvt-unicode/files/patch-src::screen.C	2011-04-19 23:58:32.000000000 +0200
@@ -0,0 +1,73 @@
+--- src/screen.C.orig	2011-04-19 23:53:53.000000000 +0200
++++ src/screen.C	2011-04-19 23:57:02.000000000 +0200
+@@ -3619,6 +3619,7 @@
+ rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW
+ {
+   XSelectionEvent ev;
++  Atom property;
+ 
+   ev.type = SelectionNotify;
+   ev.property = None;
+@@ -3628,6 +3629,16 @@
+   ev.target = rq.target;
+   ev.time = rq.time;
+ 
++  /* ICCCM: 2.2. Responsibilities of the Selection Owner   
++   * SelectionRequest:
++   * If the specified property is None , the requestor
++   * an obsolete client. Owners are encouraged
++   * to support these clients by using the specified
++   * target atom as the property name to be used for
++   * the reply.
++   */
++  property = (rq.property == 0) ? rq.target : rq.property;
++
+   if (rq.target == xa[XA_TARGETS])
+     {
+       Atom target_list[6];
+@@ -3642,10 +3653,10 @@
+       *target++ = xa[XA_UTF8_STRING];
+ #endif
+ 
+-      XChangeProperty (dpy, rq.requestor, rq.property, XA_ATOM,
++      XChangeProperty (dpy, rq.requestor, property, XA_ATOM,
+                        32, PropModeReplace,
+                        (unsigned char *)target_list, target - target_list);
+-      ev.property = rq.property;
++      ev.property = property;
+     }
+ #if TODO // TODO
+   else if (rq.target == xa[XA_MULTIPLE])
+@@ -3655,15 +3666,15 @@
+ #endif
+   else if (rq.target == xa[XA_TIMESTAMP] && rq.selection == XA_PRIMARY && selection.text)
+     {
+-      XChangeProperty (dpy, rq.requestor, rq.property, rq.target,
++      XChangeProperty (dpy, rq.requestor, property, rq.target,
+                        32, PropModeReplace, (unsigned char *)&selection_time, 1);
+-      ev.property = rq.property;
++      ev.property = property;
+     }
+   else if (rq.target == xa[XA_TIMESTAMP] && rq.selection == xa[XA_CLIPBOARD] && selection.clip_text)
+     {
+-      XChangeProperty (dpy, rq.requestor, rq.property, rq.target,
++      XChangeProperty (dpy, rq.requestor, property, rq.target,
+                        32, PropModeReplace, (unsigned char *)&clipboard_time, 1);
+-      ev.property = rq.property;
++      ev.property = property;
+     }
+   else if (rq.target == XA_STRING
+            || rq.target == xa[XA_TEXT]
+@@ -3744,10 +3755,10 @@
+           ct.encoding = target;
+         }
+ 
+-      XChangeProperty (dpy, rq.requestor, rq.property,
++      XChangeProperty (dpy, rq.requestor, property,
+                        ct.encoding, 8, PropModeReplace,
+                        ct.value, (int)ct.nitems);
+-      ev.property = rq.property;
++      ev.property = property;
+ 
+       if (freect)
+         XFree (ct.value);
--- rxvt-unicode-9.10_1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104192256.p3JMuNSH071992>