#4 patch to fix DB byte order problem

closed-postponed
nobody
None
5
2002-12-07
2002-11-13
Tim Witham
No

If you use bogofilter from both a small endian machine
(perhaps where you read mail) and a big endian one
(perhaps your mail server), it will not function
properly. This is because the word counts are stored
in native format which produces wrong results on a
platform of the opposite byte order.

This patch fixes that by putting the database values in
network order and reordering the bytes at run-time on
little endian platforms. In other words, the database
is made portable across platforms of differing native
byte order.

The patch is against version 0.8.0's datastore_db.c.

Discussion

  • Tim Witham
    Tim Witham
    2002-11-13

    endian-fix-0.8.0.patch

     
    Attachments
  • Tim Witham
    Tim Witham
    2002-11-13

    Logged In: YES
    user_id=12085

    p.s. I used a function from db-4.1 to test endianness. That
    may or may not work with older DBs; I have not tested this.
    Might be better to include the test if unsure, or try to
    figure it out at configure time.

     
  • David Relson
    David Relson
    2002-11-14

    Logged In: YES
    user_id=30510

    Tom,

    I've downloaded the patch, but my copy of BerkeleyDB, i.e.
    db3.3-3.3.11, doesn't have isbigendian. So I've passed the
    patch on to the development mailing list, i.e.
    bogofilter-dev@aotto.com, for testing. Feel free to join
    the developer list or the regular list, i.e.
    bogofilter@aotto.com.

    I'll let you know how it goes.

    Thanks for reporting the problem and providing a fix.

    David

     
    • status: open --> closed-postponed
     
  • Logged In: YES
    user_id=2788

    Does the problem persist with bogofilter 0.9.1.2?