OpenSolaris

Printable Version Enter a New Search
Bug ID 6314490
Synopsis X app dumps core with LC_ALL != C when XtOpenDisplay() is called twice
State 10-Fix Delivered:Verified (Fix available in build)
Category:Subcategory xserver:i18n
Keywords XtCloseDisplay() | XtOpenDisplay() | asia-bugs | libx11
Responsible Engineer Yandong Yao
Reported Against solaris_8
Duplicate Of
Introduced In
Commit to Fix s8_patch
Fixed In s8_patch
Release Fixed solaris_8(s8_patch) , solaris_9(Unknown) (Bug ID:2129281) solaris_10(Bug ID:2129282,)
Related Bugs 5048853
Submit Date 23-August-2005
Last Update Date 10-April-2007
Description
X application dumps core with LC_ALL != C when XtOpenDisplay() is called twice.
It occurs on Solaris 8 with Xsun patch#108652-86 or higher is applied.
(Also, I confirmed it occurs on Solaris 9 and on Solaris 10.)

Following is the test case sample code to reproduce this bug.

# cat test.c
/*
 * cc -o test test.c -lXt -lX11
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/Intrinsic.h>
#include <X11/Xlocale.h>

int
main ( int argc, char *argv[] ) {
   XtAppContext  appcon;
   Display      *dpy;
   int           ka = 0;

   if ( setlocale( LC_ALL, "" ) == NULL ) {
      printf( "Can not set locale\n" );
      exit( 1 );
   }
   if ( ! XSupportsLocale() ) {
      printf( "Does not support locale\n" );
      exit( 1 );
   }

   XtToolkitInitialize();
   appcon = XtCreateApplicationContext();

   dpy = XtOpenDisplay( appcon, NULL, NULL, "test", NULL, NULL, &ka, NULL );
   if ( dpy == NULL ) {
      printf( "Can not open display\n" );
      exit( 1 );
   }  
   printf( "1st XtOpenDisplay() succeeded\n" );
   XtCloseDisplay( dpy );          
    
   dpy = XtOpenDisplay( appcon, NULL, NULL, "test", NULL, NULL, &ka, NULL );
   if ( dpy == NULL ) {            
      printf( "Can not open display\n" );
      exit( 1 );
   }
   printf( "2nd XtOpenDisplay() succeeded\n" );
   XtCloseDisplay( dpy );

   sleep ( 1 );
   printf( "Test completed\n" );
   return ( 0 );
}

# cc -o test test.c -lXt -lX11
# setenv LC_ALL C
# ./test
1st XtOpenDisplay() succeeded
2nd XtOpenDisplay() succeeded
Test completed
# setenv LC_ALL ja
# ./test
1st XtOpenDisplay() succeeded
Segmentation Fault (core dumped)
#
# pstack core
core 'core' of 2431:    ./test
 fef61778 ???????? (210a8, ff29ce20, 210a8, ff29ce2c, ffbef418, ff141cc4)
 ff215868 _XrmDefaultInitParseInfo (29190, 2853c, ff29a000, 210a8, ff1c2840, 0)
+ 40
 ff212e1c NewDatabase (28538, ff29a000, 8, 18, 225b0, ff141cc4) + 4c
 ff212d30 XrmGetStringDatabase (332b0, ff29a000, 1fd, 332b0, 22320, 1ff) + 14
 ff3316a8 CombineUserDefaults (26b88, 27e78, ff382000, ff29a000, 157, 26) + 28
 ff331558 GetLanguage (26b88, 27d3c, ff382000, 26b88, 99, 127) + 84
 ff331204 _XtDisplayInitialize (26b88, 27d3c, ff36e24c, 0, 0, ffbefc80) + 20
 ff3308f8 XtOpenDisplay (26b88, 0, 0, ffbefc80, 0, 0) + 1b0
 00010910 main     (1, ffbefcf4, ffbefcfc, 20800, 23240, 26b88) + 100
 000107e8 _start   (0, 0, 0, 0, 0, 0) + 108
#
to verify this issue in s8, you must install patches as below:
s8 sparc:109147-26, 108652-86 or higher
s8 i386:109148-26, 108653-86 or higher
to reproducde this issue for s9, you must install patch:
sparc:112785
i386:112786
Work Around
a) To run with LC_ALL=C, or

b) To remove XtCloseDisplay()
      =====
      XtCloseDisplay( dpy );
      =====
    ->
      =====
      /* XtCloseDisplay( dpy ); */
      =====

*** (#1 of 1): [ UNSAVED ]  xxxxx@xxxxx.com
Comments
N/A