[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: slapadd segfaults with sub,approx indexing on UTF-8 data (ITS#1215)



On Tue, Jun 26, 2001 at 02:53:57PM +0000, kartik_subbarao@hp.com wrote:
> I have the following indexing configured in slapd.conf:
> 
> index cn pres,eq,sub,approx
> index givenName pres,eq,sub,approx
> 
> When I use slapadd to add entries with UTF-8 characters in them, slapadd
> segfaults. Here is an example LDIF file:

I tried to reproduce this with todays CVS devel version, the same indexing
and the same LDIF file as you. It worked quite well, no errors.

Could you add the following printf's to approxIndexer (around line 940)
and give me the output?

        for( i=0; values[i] != NULL; i++ ) {
                printf( "values[%d]:%s\n", i, values[i]->bv_val );
                keys[i] = ch_malloc( sizeof( struct berval * ) );
                keys[i]->bv_val = phonetic( values[i]->bv_val );
                printf( "keys[%d]:%s\n", i, keys[i]->bv_val );
                keys[i]->bv_len = strlen( keys[i]->bv_val );
        }

I'm getting:

# values:1
values[0]:Jürgen Test
keys[0]:J
# values:1
values[0]:Jürgen
keys[0]:J

The key is only from the first word and the à is treated as a word
break unfortunately. This should be fixed I think. I don't understand
why it's only the first word either. Anyway, this shouldn't be relevant.
Could you check if it also crashes if you use just J as cn and givenName.
Maybe also try Juergen Test and Juergen, then you should in both cases
get JRGN.

Next I would suggest a printf in index.c (you might use gdb instead).

        if( rc == LDAP_SUCCESS && keys != NULL ) {
             for( i=0; keys[i] != NULL; i++ ) {
                printf( "indexer() keys[%d]:%s\n", i, keys[i]->bv_val );
	        key_change( be, db, keys[i], id, op );
             }
             ber_bvecfree( keys );
        }

The printf should be on line 203.

The complete output for me then is:

# values:1
values[0]:Jürgen Test
keys[0]:J
indexer() keys[0]:J
# values:1
values[0]:Jürgen
keys[0]:J
indexer() keys[0]:J

What do you get?

Does it work if you only do approx indexing?

I'm a bit lost here, it's not easy when I can't reproduce it.

Stig