DB backend support for lmdb?

Matthias Andree matthias.andree at gmx.de
Sat Jan 26 11:02:01 CET 2019


Am 25.01.19 um 23:53 schrieb Steffen Nurpmeso:
> Hallo Matthias!
>
> Matthias Andree wrote in <a4aecb7f-fa93-f918-dec4-a9a47926f1d9 at gmx.de>:
>  |Am 17.01.19 um 19:06 schrieb Steffen Nurpmeso:
>  |> Matthias Andree wrote in <c4f77995-7556-9fe0-e7e7-e6470fa6f715 at gmx.de>:
>  ...
>  |> Due to some thread on a NetBSD ML i had a glance on the LMDB code
>  |> and saw that one overflow check condition was not right.  It
>  |> cannot happen in practice because LMDB key length restriction is
>  |> far below 31-bit (511 bytes by default), but still one overflow
>  |> could happen and would not be detected because of wraparound.
>  |> This is fixed by the attached patch.  (Tests all fine but the
>  |> skipped ones.)
>  |>
>  |> Do you have any plans on doing a new bogofilter release?  It is of
>  |> course nothing but purely selfish ... but KyotoCabinet is also
>  |> a new backend, and is lingering for some time, too.  If i diff
>  |> from my imported master (v1.2.4), there are quite some changes.
>  |> (I definetely have seen releases with fewer changes.)
>  |>
>  |> No git yet it seems, but v1.2.4 seems to be more than five years
>  |> old, hm hm.  v1.2.5 would be cool, anyway!
>  ...
>  |indeed no Git yet, real-life work went crazy last autumn as in really
>  |crazy, so I pushed everything back quite a bit.
>
> Yes, of course.  You have been talking about it, that is why.
> I normally do not have all the auto* series installed, so my
> personal interest tends to look in direction pre-prepared ball...

Hi Steffen,

indeed. At any rate, your patch has been committed as r7078, my
apologies for miscapitalizing your first name.

>  |Thanks for proactively maintaining and catching up your LMDB support so
>  |we can refine it!
>
> I was only fixing a bad overflow check, which should have been
> avoided from the start.  If it would be that easy.

:-) Plans sometimes fail the test of reality.

>  |However, can I ask you to resend the patch without the many
>  |reformattings? There's a lot of
>  |
>  |foo *     ->    foo*
>  |
>  |reformatting going on that obscures the actual change.
>
> Mist!  You recognized it!!!  I have now compiled with C++ compiler
> by myself, to proactively avoid that you have to add more of that
> terrible "foo *" syntax instead of my beautiful "foo*" notation.
> Fixed in the below.

Beauty lies in the eye of the beholder, they say. Having the C code
written in a C++ compatible way may help portability such that if people
use arcane systems that don't have a decent C compiler, they sometimes
at least have a reasonable C++ compiler... most of these C-style casts
happen because C++ doesn't implicitly cast void * to other pointer types.

We could use a macro. Or switch to C++ 17. Or just go as it is with a
few casts around the *alloc() functions, which is what I'll do for the
time being.

Thanks again!

Best,
Matthias




More information about the bogofilter-dev mailing list