Bug 376 - XkbWriteRulesProp fails if XkbRulesFile is NULL
Summary: XkbWriteRulesProp fails if XkbRulesFile is NULL
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: SPARC Solaris
: medium normal
Assignee: Alan Coopersmith
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-26 09:03 UTC by Alan Coopersmith
Modified: 2004-03-25 14:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch to xc/programs/Xserver/xkb/xkbInit.c (390 bytes, patch)
2004-03-26 09:05 UTC, Alan Coopersmith
no flags Details | Splinter Review

Description Alan Coopersmith 2004-03-26 09:03:35 UTC
(This shouldn't be a problem for servers using the XFree86-based keyboard 
 DDX'es, since it calls XkbSetRulesDflts to set XkbRulesFile, but can cause
 problems for some of the other servers.  I found it while debugging the Xsun
 server.)

XkbWriteRulesProp calculates how long of a string it needs to allocate,
allocates the string and fills it in, but then aborts if it didn't fill in
the same length it calculated.

When calculating how much room to allocate it checks to see if XkbRulesFile
is NULL.  If it's not, it uses the length of it, otherwise it uses the length
of the XKB_DFLT_RULES_FILE #define'd string.

When filling in the string however, if XkbRulesFile is NULL, it doesn't copy
in any text for the rules entry, thus causing the string lengths to mismatch
and the _XKB_RULES_NAMES property will not be set on the root window.

Adding a simple else clause to fill in the rules value with the string from
XKB_DFLT_RULES_FILE allows the function to work properly and the property is
set.

[Also reported to XFree86 bugzilla #1115]
Comment 1 Alan Coopersmith 2004-03-26 09:05:14 UTC
Created attachment 167 [details] [review]
Patch to xc/programs/Xserver/xkb/xkbInit.c
Comment 2 Alan Coopersmith 2004-03-26 09:14:08 UTC
CVSROOT:	/cvs/xorg
Module name:	xc
Changes by:	alanc@pdx.	04/03/26 09:11:49

Log message:
    29.  XkbWriteRulesProp fails if XkbRulesFile is NULL. Bug #376.
         (Alan Coopersmith)

Modified files:
      ./:	Tag: XORG-CURRENT
        CHANGELOG-CURRENT 
      xc/programs/Xserver/xkb/:	Tag: XORG-CURRENT
        xkbInit.c 
  
  Revision      Changes    Path
  1.1.2.27      +3 -1      xc/Attic/CHANGELOG-CURRENT
  1.1.4.5       +4 -0      xc/programs/Xserver/xkb/xkbInit.c


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.