Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 59587 - rxvt-unicode crashes while highlighting text under x.org on amd64
Summary: rxvt-unicode crashes while highlighting text under x.org on amd64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal
Assignee: AMD64 Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-05 23:38 UTC by Andrew Williams
Modified: 2004-09-09 15:12 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Williams 2004-08-05 23:38:29 UTC
rxvt-unicode will compile and emerge correctly and runs without any warnings or errors. However, selecting text with the mouse causes it to crash with an X error. 

Reproducible: Always
Steps to Reproduce:
1. emerge x11-terms/rxvt-unicode
2. urxvt
3. type some text and select with mouse

Actual Results:  
I tried it three times in a row. Here are the error messages I got: 
 
X Error of failed request:  BadValue (integer parameter out of range for 
operation) 
  Major opcode of failed request:  18 (X_ChangeProperty) 
  Value in failed request:  0x40 
  Serial number of failed request:  824 
  Current serial number in output stream:  825 
 
X Error of failed request:  BadValue (integer parameter out of range for 
operation) 
  Major opcode of failed request:  18 (X_ChangeProperty) 
  Value in failed request:  0x40 
  Serial number of failed request:  929 
  Current serial number in output stream:  930 
 
X Error of failed request:  BadValue (integer parameter out of range for 
operation) 
  Major opcode of failed request:  18 (X_ChangeProperty) 
  Value in failed request:  0x40 
  Serial number of failed request:  866 
  Current serial number in output stream:  867 
 

Expected Results:  
Selected the text without crashing, allowing it to be copied. 

It works fine on my other computer, a Pentium 4, and from within a 32-bit 
chroot environment on the Athlon64, so I presume it's a 64-bit problem. I 
tried packaging a 32-bit version on the P4 and installing it with emerge -k 
but it complains that: 
 
urxvt: the locale is not supported by Xlib, working withotu (sic) locale 
support. 
 
This is under both UTF-8 and C locales, so that's not a solution. 
 
Compiling with the CFLAGS toned down makes no difference. 
 
emerge info: 
 
Portage 2.0.50-r9 (gcc34-amd64-2004.1, gcc-3.4.1, glibc-2.3.4.20040619-r1, 
2.6.7-gentoo-r10) 
================================================================= 
System uname: 2.6.7-gentoo-r10 x86_64 4 
Gentoo Base System version 1.5.2 
ccache version 2.3 [enabled] 
Autoconf: sys-devel/autoconf-2.59-r4 
Automake: sys-devel/automake-1.8.5-r1 
ACCEPT_KEYWORDS="amd64 ~amd64" 
AUTOCLEAN="yes" 
CFLAGS="-O2 -march=athlon64 -mtune=athlon64 -pipe -maccumulate-outgoing-args 
-fomit-frame-pointer -fweb" 
CHOST="x86_64-pc-linux-gnu" 
COMPILER="gcc3" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3.3/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-O2 -march=athlon64 -mtune=athlon64 -pipe -maccumulate-outgoing-args 
-fomit-frame-pointer -fweb" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs ccache" 
GENTOO_MIRRORS="http://gentoo.blueyonder.co.uk 
http://www.mirror.ac.uk/sites/www.ibiblio.org/gentoo 
http://www.ibiblio.org/pub/Linux/distributions/gentoo" 
MAKEOPTS="-j2" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/data/port_tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="/usr/local/portage" 
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" 
USE="X aalib acpi aim alsa amd64 apache2 apm arts avi berkdb bonobo breakme 
bzlib calendar cdr crypt cups dga doc dvd dvdr encode esd exif f77 fam flac 
foomaticdb gdbm ggi gif gimpprint gnome gnome2 gphoto2 gpm gstreamer gtk gtk2 
gtkhtml guile imagemagick imap imlib jabber java jpeg kde ldap libg++ libwww 
mad maildir mikmod mime motif mozilla mpeg multilib mysql nas ncurses netcdf 
network nls oggvorbis opengl oss pam pcre pdflib perl plotutils png python qt 
quicktime radeon readline scanner sdl slang spell ssl svg tcltk tcpd tetex 
theora truetype unicode v4l v4l2 videos wmf xine xml xml2 xmms xv xvid zlib"
Comment 1 Andrew Williams 2004-08-05 23:47:50 UTC
Oops - I should point out that this occurs on every version of rxvt-unicode I've ever tried, including the latest in portage 3.2.

Andrew (Alshain)
Comment 2 Tom Martin (RETIRED) gentoo-dev 2004-08-07 08:44:30 UTC
I've been using rxvt-unicode for a few days, and I've had no such problems.  What selection behaviour are you using, or are you not defining it especially?  Could you attach your .Xdefaults? 
Comment 3 Andrew Williams 2004-08-07 22:19:44 UTC
My .Xdefaults is:

urxvt.geometry: 80x60
urxvt.inheritPixmap: true
urxvt.loginShell: true
urxvt.scrollBar: true
urxvt.scrollBar_right: true
urxvt.saveLines: 2000
urxvt.foreground: light grey
urxvt.tintColor: grey21
urxvt.background: grey21
urxvt.internalBorder: 0

although removing the .Xdefaults file entirely makes no difference to the crashing problem. I'm not defining the selection behaviour, I'm just using the plain ebuild. I should also point out that I'm using X.org and not Xfree although I don't see that should make a difference.

Andrew
Comment 4 Tom Martin (RETIRED) gentoo-dev 2004-08-08 14:48:45 UTC
Well that *is* a poser. I have absolutely no idea why this is, although I am rather suspect of your CFLAGS. Just a wild guess, but could you try recompiling xfree with conservative CFLAGS (shouldn't take that long).

By the way, you probably want to change -march=athlon64 to -march=k8 in your CFLAGS, and the -mtune stuff is redundant with -march, as far as I know.
Comment 5 Andrew Williams 2004-08-08 23:35:50 UTC
I've tried recompiling rxvt-unicode with no CFLAGS and it still crashes. I'm using X.org, not XFree - have you tried it with that? Just in case.

Anyway, I tracked down the problem - in the latest version (3.4) it occurs at line 3441 in the file screen.C, which looks like this:

XChangeProperty (display->display, rq.requestor, rq.property, XA_INTEGER,
                       (8 * sizeof (Time)), PropModeReplace,
                       (unsigned char *)&selection_time, 1);

Brute force commenting it out allows me to copy and paste without any crashes.  Not knowing any X programming I'm not sure what it does, beyond maybe changing some property of the window. Further tweaking reveals that the (8 * sizeof (Time) appears to be too large. Setting it to anything less than 5* causes the program to work without crashing.

Okay, that's the limit of my programming knowledge - time for someone to explain why this is the case!

Andrew 
Comment 6 Danny van Dyk (RETIRED) gentoo-dev 2004-08-09 14:34:01 UTC
That
      "8*sizeof(time)"
is really crap. XChangeProperty expects either "8", "162 or "32" at this place.

Quoting the Xlib Programming Manual:

"format: Specifies whether the data should be viewed as a list of 8-bit, 16-bit,
or 32-bit quantities. Possible values are 8, 16, and 32. This information allows
the X server to correctly perform byte-swap operations as necessary. If the format
is 16-bit or 32-bit, you must explicitly cast your data pointer to an (unsigned
char *) in the call to XChangeProperty()."

So 32 should be okay for it on amd64 ;-)
Comment 7 Andrew Williams 2004-08-09 22:58:50 UTC
Yes, setting it to 32 does work!

Andrew
Comment 8 Tom Martin (RETIRED) gentoo-dev 2004-08-10 06:44:47 UTC
Kugelfang, can you reproduce this error yourself? I've been using rxvt-unicode for a while and nothing like this has  happened. I honestly think it was caused by the CFLAGS Xorg (and in turn Xlib) was compiled with.  Either way, I'll test this fix out and commit a patch as soon as possible. 
Comment 9 Danny van Dyk (RETIRED) gentoo-dev 2004-08-11 08:02:36 UTC
dvandyk@phi gentoo $ urxvt
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  18 (X_ChangeProperty)
  Value in failed request:  0x40
  Serial number of failed request:  795
  Current serial number in output stream:  796

(after highlighting text w/ mouse)

This is not due to any CFLAGS IMHO.

sizeof(Time) delivers "8 == 64bit" on my system. After some search in the X11 headers, i found Time to be a redefinition of CARD32. Odd, isn't that ?
I then tried this patch:

--- screen.C.old        2004-08-11 16:08:17.161672432 +0200
+++ screen.C    2004-08-11 16:11:35.938453768 +0200
@@ -3427,7 +3427,7 @@
   else if (rq.target == xa[XA_TIMESTAMP] && selection.text)
     {
       XChangeProperty (display->display, rq.requestor, rq.property, XA_INTEGER,
-                       (8 * sizeof (Time)), PropModeReplace,
+                       (32, PropModeReplace,
                        (unsigned char *)&selection_time, 1);
       ev.property = rq.property;
     }

but that didn't help me. rxvt still breaks when highlighting things.
ANd i just don't know enough about the X11 API to solve this. :-/
Comment 10 Danny van Dyk (RETIRED) gentoo-dev 2004-09-09 15:12:19 UTC
Okay, i'm officially dumb. It works with 32 ! This will be patched in now on all 64bit archs conditionally.

latexer will report upstream.