I'm forwarding this bug report to the members of bug#299026, `ITP: tinycdb'.
On August 17, 2006 at 3:06PM +0900, ueno (at unixuser.org) wrote: > Package: tinycdb > Version: 0.74-1 > Tags: patch > > If dlenp arg of cdb_seek point to the integer variable whose value is 0, > cdb_seek does not set dlenp correctly. This behavior is not documented > and I think it is unintended. Due to this, the dbskkd-cdb package > compiled with gcc-4.0 does not work well. > > To reproduce > > $ echo "+3,5:one->Hello\n" | cdbmake test.cdb test.cdb.tmp or use $ /bin/echo -e "+3,5:one->Hello\n" | cdbmake test.cdb test.cdb.tmp if your shell's `echo' doesn't enable interpretation of backslash escapes. > $ gcc -o testcdb testcdb.c -lcdb > $ ./testcdb ./test.cdb one > dlen = 0 # <- it should be 5 > $ cat testcdb.c > #include <stdio.h> > #include <string.h> > #include <assert.h> > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> > #include <cdb.h> > > int main (int argc, char **argv) > { > int fd, ret; > const char *key; > unsigned klen, dlen = 0; // if dlen = 1, it works as expected > > assert (argc == 3); > fd = open (argv[1], O_RDONLY); > if (fd == -1) > { > perror ("open"); > return 1; > } > > key = argv[2]; > klen = strlen (key); > ret = cdb_seek (fd, key, klen, &dlen); > if (ret == -1) > return 1; > else if (ret == 0) > printf ("not found"); > else > printf ("dlen = %d\n", dlen); > > return 0; > } > > Here is a patch to fix it > > --- cdb_seek.c~ 2006-08-17 15:02:16.000000000 +0900 > +++ cdb_seek.c 2006-08-17 15:02:43.000000000 +0900 > @@ -75,7 +75,7 @@ > /* read the key from file and compare with wanted */ > unsigned l = klen, c; > const char *k = (const char*)key; > - if (*dlenp) > + if (dlenp) > *dlenp = cdb_unpack(rbuf + 4); /* save value length */ > for(;;) { > if (!l) /* the whole key read and matches, return */ > > Regards, > -- > Daiki Ueno Daiki, thanks for your report. This bug causes my packages dbskkd-cdb and skksearch unusable. I'm thinking about applying workaround patches to dbskkd-cdb and skksearch due to this bug for the moment. Anyway, I hope this bug will be fixed shortly... Michael, could you fix this bug in tinycdb 0.76? Could anyone update the Debian tinycdb package? Thanks, -- Tatsuya Kinoshita
pgpHxivJ8MNKX.pgp
Description: PGP signature