Bug#721617: [liblo] Bug#721617: pyliblo: FTBFS on sparc: testSendOthers (unit.ServerTestCase) ... Bus error (core dumped)

John Paul Adrian Glaubitz glaubitz at physik.fu-berlin.de
Mon Aug 1 00:11:22 UTC 2016


Hello!

So, here's what I suggest:

1. Create a common header file called "unaligned.h" which contains all
   macros required for unaligned access, both for little-endian,
   big-endian and native-endian access. This can be handily sourced
   from the systemd sources [1].

2. Go through the sources and fix all of the following pointers acrobatics
   using the macros from "unaligned.h":

   glaubitz at ikarus:/tmp/liblo-0.28/src$ grep -R  \*\( *
   address.c:            *((unsigned long*)&a.addr) = inet_addr(ip);
   message.c:                        *(types - 1), file, line);
   message.c:    dsize = lo_otoh32(*(uint32_t *) data);
   message.c:        elem_len = lo_otoh32(*((uint32_t *) pos));
   message.c:        *(int32_t *) data = lo_otoh32(*(int32_t *) data);
   message.c:        *(int32_t *) data = lo_otoh32(*(int32_t *) data);
   message.c:        *(int32_t *) data = lo_otoh32(*(int32_t *) data);
   message.c:        *(int64_t *) data = lo_otoh64(*(int64_t *) data);
   message.c:        *(int32_t *) data = lo_htoo32(*(int32_t *) data);
   message.c:        *(uint32_t *) data = lo_htoo32(*(uint32_t *) data);
   message.c:        *(uint32_t *) data = lo_htoo32(*(uint32_t *) data);
   message.c:        *(int64_t *) data = lo_htoo64(*(int64_t *) data);
   message.c:            val32.nl = lo_otoh32(*(int32_t *) data);
   message.c:            val32.nl = *(int32_t *) data;
   message.c:            bigendian ? lo_otoh32(*(uint32_t *) data) : *(uint32_t *) data;
   message.c:            bigendian ? lo_otoh32(*(uint32_t *) data) : *(uint32_t *) data;
   message.c:            val64.nl = lo_otoh64(*(int64_t *) data);
   message.c:            val64.nl = *(int64_t *) data;
   message.c:                printf("%#02x", (unsigned int)*((unsigned char *) (data) + 4 + i));
   message.c:            printf("0x%02x", *((uint8_t *) (data) + i));
   server.c:    s->sockets = calloc(2, sizeof(*(s->sockets)));
   server.c:    s->contexts = calloc(2, sizeof(*(s->contexts)));
   server.c:                *(*buffer)++ = *from++;
   server.c:                *(*buffer)++ = SLIP_END;
   server.c:                *(*buffer)++ = SLIP_ESC;
   server.c:        uint32_t msg_len = ntohl(*(uint32_t*)sc->buffer);
   server.c:            *(uint32_t*)(sc->buffer + sc->buffer_read_offset) = 0;
   server.c:            *(uint32_t*)(sc->buffer + sc->buffer_msg_offset) = htonl(msg_len);
   server.c:            *(uint32_t*)(sc->buffer + sc->buffer_msg_offset) = 0;
   server.c:                           sizeof(*(s->sockets)) * (s->sockets_alloc * 2));
   server.c:                     sizeof(*(s->contexts))
   server.c:        ts.sec = lo_otoh32(*((uint32_t *) pos));
   server.c:        ts.frac = lo_otoh32(*((uint32_t *) pos));
   server.c:            elem_len = lo_otoh32(*((uint32_t *) pos));
   server.c:        if (pos && *(pos + 1) == '\0') {
   server_thread.c:            pthread_create(&(st->thread), NULL, (void *(*)(void *)) &thread_func, st);
   testlo.c:    *(uint32_t *) (data + 8) = lo_htoo32((uint32_t) 99999);
   testlo.c:        *(uint32_t*)msg = htonl(24);
   testlo.c:        *(uint32_t*)(msg+28) = htonl(8);
   glaubitz at ikarus:/tmp/liblo-0.28/src$

   Since the unaligned.h header already caters of BE/LE systems, we can use these macros
   instead lo_otoh32, for example.

Thanks,
Adrian

> [1] https://raw.githubusercontent.com/systemd/systemd/master/src/basic/unaligned.h

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz at debian.org
`. `'   Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



More information about the pkg-multimedia-maintainers mailing list