Subject: Re: xset r rate -> memory fault
To: None <netbsd-users@netbsd.org>
From: Jan Schaumann <jschauma@netbsd.org>
List: netbsd-users
Date: 03/01/2002 15:28:54
--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Jan Schaumann <jschauma@netbsd.org> wrote:
> Jan Schaumann <jschauma@netbsd.org> wrote:
>
> > I'm puzzled by the fact that "xset r rate 500 30" gives me a
> > memory-fault (with core dump), but at the same time, if I start the X
> > server with "-ar1 500 -ar2 30" everything works as expected.
>
> > This is on an i386 with XFree86 Version 4.0.99.3
>
> FWIW, I found out that it works just fine with a new version of XFree86
> Version 4.1.0. I haven't yet determined what the problem was exactly,
> though...
Ok, I take that back. Things are (were) weird: After upgrading
XFree86, the problem seemed to disappear for some instances, but
presisted in others. AFAICT, the reason for "xset" to segfault was that
"xkbset_repeatrate" did not check the return-value from
"XkbGetKeyboard", assuming it would always get a proper value back.
In some instances (why, I have not yet been able to determine), the
function does however NOT return a pointer to the keyboard, and
naturally the next function-call segfaults.
I was able to fix the problem with the attached patch to
/usr/src/xsrc/xfree/xc/programs/xset/xset.c (that is, if no keyboard
pointer is returned, allocate a new one using defaults).
The curious thing is that this would indicate that the first call to
"XkbGetKeyboard" does not find the default keyboard (XkbUseCoreKbd),
while the second one does. Two virtually identical machines (wrt to
configuration) showed different behaviour: one always returned the
proper keyboard pointer, one didn't. I yet have to track down why this
is.
Anyway, maybe the attached patch will help somebody, otherwise: It was
nice to have a conversation with myself. To be continued... (?)
-Jan
--
finger jschauma@netmeister.org
Please do not CC me when replying to messages on a Mailing List.
See Mail-Followup-To header (above) and
http://www.google.com/search?q=Mail-Followup-To+Header
--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xset.diff"
--- xset.c.orig Fri Mar 1 15:22:41 2002
+++ xset.c Fri Mar 1 15:24:08 2002
@@ -1089,6 +1089,8 @@
xkbset_repeatrate(Display *dpy, int delay, int interval)
{
XkbDescPtr xkb = XkbGetKeyboard(dpy,XkbControlsMask,XkbUseCoreKbd);
+ if (!xkb)
+ xkb = XkbAllocKeyboard();
XkbGetControls(dpy, XkbRepeatKeysMask, xkb);
xkb->ctrls->repeat_delay = delay;
xkb->ctrls->repeat_interval = interval;
--gKMricLos+KVdGMg--