Gdbm reorganize error

Denys Duchier duchier at ps.uni-sb.de
Wed Feb 5 00:42:52 CET 2003


Unfortunately, it appears that NONE of the several purported fixes
that our valiant Windows heroes, Thorsten Brunklaus and Leif
Kornstaetd (oh hum... sounds like "vikings for hire. have
drakkar. will plunder" :-), tracked down and tried actually worked for
your problem.  So the problem persists.  And it persists not merely
for Mozart, but for the Windows platform in general.  I suggest that
you get in touch with the GDBM developers as well as the MinGW
developers and lobby to get this issue resolved.  I attach below a C
program authored by "Our Valiant Heroes" (TM) that can be used to
reproduce the problem.

-------------- next part --------------
#include <stdio.h>
#include <string.h>
#include "gdbm.h"

int main(void) {
  GDBM_FILE file;

  int block_size = 0;

  fprintf(stderr, "testing version %s\n", gdbm_version);
  file = gdbm_open("test.gdbm", block_size,
		   GDBM_NEWDB | GDBM_SYNC,
		   00664, NULL);
  if (file == NULL) {
    fprintf(stderr, "gdbm_open failed, %s\n", gdbm_strerror(gdbm_errno));
    exit(2);
  }

  datum key_data;
  datum data_data;

  char *sample_data = "This is a sample entry\n"; 

  data_data.dptr = sample_data;
  data_data.dsize = strlen(sample_data) + 1;
  char key[100];
  for (int i = 0; i <= 1000; i++) {
    sprintf(key, "%d", i);
    key_data.dptr = strdup(key);
    key_data.dsize = strlen(key) + 1;
    if (gdbm_store(file, key_data, data_data, GDBM_REPLACE) != 0) {
      fprintf(stderr, "item not inserted\n");
    }
  }
  for (int i = 0; i < 1000; i++) {
    sprintf(key, "%d", i);
    key_data.dptr = strdup(key);
    key_data.dsize = strlen(key) + 1;
    if (gdbm_delete(file, key_data) != 0) {
      fprintf(stderr, "item not deleted\n");
    }
  }
  if (gdbm_reorganize(file) != 0) {
    fprintf(stderr, "db error: %s\n", gdbm_strerror(gdbm_errno));
    exit(0);
  }
  gdbm_close(file);
  return 0;
}
-------------- next part --------------

It's out of our hands! psshhh! what a relief!

Cheers,

-- 
Dr. Denys Duchier
?quipe Calligramme
LORIA, Nancy, FRANCE


More information about the mozart-users mailing list