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

Re: Tests fail on RedHat 6.0 (ITS#156)


your problem is obviously caused by the following lines in db2/db/db.c,
part of the BerkeleyDB2 implementation of glibs 2.1:

	if (dbinfo != NULL && dbinfo->db_cachesize != 0) {
		    "cachesize will be ignored if environment exists");
		return (EINVAL);

In other words, the reason lies in libraries/libldbm/ldbm.c:

    #ifdef HAVE_BERKELEY_DB2
	DB_INFO dbinfo;
	int result;

	memset( &dbinfo, 0, sizeof( dbinfo ));
	dbinfo.db_cachesize = dbcachesize;
	dbinfo.db_pagesize  = DEFAULT_DB_PAGE_SIZE;
	dbinfo.db_malloc    = ldbm_malloc;

	result = db_open( name, DB_TYPE, rw, mode, &ldbm_Env, &dbinfo, &ret );
	printf("db_open returns %d\n", result);

The above code will *always* send a Non-NULL ldbm_Env, thus any value
for dbcachesize different from 0 will cause the db2 library to return
EINVAL immediately.

I don't know why this problem arises suddenly, perhaps something
changed between glibc 2.0 and 2.1.

As a workaround I have changed

	dbinfo.db_cachesize = dbcachesize;


	dbinfo.db_cachesize = 0;

which is obviously not the ultimate solution, but I don't understand the
details of the BerkeleyDB implementation, in particular not why both
an "environment" (ldbm_Env) and the dbinfo variables are used.

An optimal solution would try to detect whether glibc 2.1 is used and
then enable some workaround.



Jochen Wiedmann						joe@ispsoft.de
How come the .45 is the worlds only functional		+49 7123 14887
point and click interface? (Alan Cox)