Hi Gregor!

On 9/25/22 17:07, Gregor Riepl wrote:
openldap FTBFS on sparc64 due to an unaligned access in the testsuite:

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 
   971 |         s = (unsigned short *)&(src);   \
       |                               ^~~~~~
./../../../libraries/liblmdb/mdb.c:6799:41: note: in expansion of macro 
  6799 |                                         COPY_PGNO(fp->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.

Thanks for the additional investigation. Could you add that information to the 
upstream bug [1]?


[1] https://bugs.openldap.org/show_bug.cgi?id=9916

 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Reply via email to