https://bugs.openldap.org/show_bug.cgi?id=9916
--- Comment #1 from glaubitz@physik.fu-berlin.de --- Quoting a comment in the Debian bug report:
Adding __attribute__((packed)) to the MDB_page struct creates some memory alignment warnings, but it will make the test cases succeed:
./../../../libraries/liblmdb/mdb.c: In function ‘mdb_cursor_put’: ./../../../libraries/liblmdb/mdb.c:971:31: warning: taking address of packed member of ‘struct MDB_page’ may result in an unaligned pointer value [-Waddress-of-packed-member] 971 | s = (unsigned short *)&(src); \ | ^~~~~~ ./../../../libraries/liblmdb/mdb.c:6799:41: note: in expansion of macro ‘COPY_PGNO’ 6799 | COPY_PGNO(fp->mp_pgno, mp->mp_pgno); | ^~~~~~~~~
I get some errors later on, unfortunately:
00:03:39 Starting test018-syncreplication-persist for mdb...
running defines.sh Starting provider slapd on TCP/IP port 9011... Using ldapsearch to check that provider slapd is running... Using ldapadd to create the context prefix entry in the provider... Starting consumer slapd on TCP/IP port 9014... Using ldapsearch to check that consumer slapd is running... Using ldapadd to populate the provider directory... Waiting 7 seconds for syncrepl to receive changes... Using ldapsearch to read all the entries from the provider... ldapsearch failed at provider (254)! ./scripts/test018-syncreplication-persist: 128: kill: No such process
This could be a different issue, though, or maybe caused by my experimentation.
Looks like the extremely conservative memory usage of liblmdb leads to all sorts of problems when the target architecture doesn't like unaligned memory access. 🙁
Interestingly, there seem to be provisions for aligning memory access in liblmdb, as evidenced by the macro MISALIGNED_OK (which is unset on sparc64). Still, it's not enough to produce working code.
The Bus Error also does not occur when compiling with -O0.
<<<