Around 2002, I started working on a project that involved a few simple database tables, and I wanted it
simple, so I used python and the gdbm module.* Since then, all has been well.* Now I find that not only
do the gdbm modules of python and perl reject my files, but so does a C program that uses the distributed
libgdbm.
Okay, so you think I broke my files somehow.* I was afraid that was true, so I used the gdbm source
I had in distfiles, configured it with default setup but did not install it.* Instead I compiled it with my
C test program, and set out to find the problem in the data, more or less expecting
to spend a long time in the debugger.* But lo and behold, it worked just fine.* Now I'm suspecting that
the ebuild does something (Large File support?) to the GDBM that it didn't used to do.
I did not know when I started how much configuration information I was going to need, and so there's
a configuation database.* As it happens, I never put more than one record in it, so it's perfect for
simple testing.* The database is called dbhex.control, and the single record key is "control".* I've
attached it.
I used this Makefile, with no targets or rules, just to get the flags I want: I have my testfile 'testgdbm.c' in
the same directory with the makefile, and a gdbm-1.8.3 directory.
I make testgdbm, run "testgdbm dbhex.control" and get exactly what I should.* If I link against the
Gentoo gdbm distribution, I get error 22 "invalid argument".* Not knowing much about ebuilds, I'm not sure
how to tell what has changed.
Can anybody help me with:
* 1) why it fails now with Gentoo tools.
* 2) the best way to get it working again, preferably with both python and C.* I expect there's either
***** a compatibility flag, or I may need to do a file conversion.* Overall, my databases run to about
***** 3 gigabytes, so it's doable either way.
/**
** @file
**
** Program to test minimal functionality of the gdbm library on a known gdbm file.
**
** Last Modified: Mon Aug* 9 12:01:32 PDT 2010</pre>
fatal(void) {
* fprintf(stderr, "Fatal function called
");
* fprintf(stderr, "Errno is %d
", errno);
* exit(EXIT_FAILURE);
}
/** The main thing.
** @param argc the number of tokens on the input line.
** @param argv an array of tokens.
** @return 0 on success, 1-255 on failure
**/
int
main(int argc, char *argv[])
{
* datum key;
* datum value;
* datum nextkey;
* char longbucket[4096];
Now I find that not only
do the gdbm modules of python and perl reject my files, but so does a C program that uses the distributed
libgdbm.
You didn't say how long ago the problem started, but looking at the
files in sys-libs/gdbm I see nothing newer than March 20. Is your
problem newer than March 20?
Have you tried running your test program with strace?