Package: orbit2
Severity: important
Tags: patch

Hi,

orbit2 is currently on m68k seriously broken and makes packages like
gconf2 unusable (see #336289 and #348010).
The reason is that m68k has some rather unusual alignment rules and this
breaks several alignment assumptions in the orbit2 code.
The attached patch fixes them, as far as I could find them and lets the
test suite pass successfull (see the patch for more detailed info).
Please consider applying the patch and releasing it as soon as possible.
Thanks.

bye, Roman

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: m68k
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.4.30
Locale: LANG=de_DE.UTF-8, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
- The code treats GIOPMsgRequest_1_0 and GIOPMsgRequest_1_1 as equal,
  but they aren't on m68k, a simple fix is to add the padding to
  GIOPMsgRequest_1_0 as well. The more complex solution, would be to
  duplicate the code dealing with these two structures.
- giop-recv-buffer.c expects a buffer to be aligned at 4 bytes, but
  giop_recv_buffer_use_encaps() doesn't check for this.
- The assert in CORBA_ORB_init() triggers during startup, because the
  alignment is 2 and since only the lowest bit is used, this should be
  sufficient.


diff -ur orbit2-2.14.0.org/include/orbit/GIOP/giop-types.h 
orbit2-2.14.0/include/orbit/GIOP/giop-types.h
--- orbit2-2.14.0.org/include/orbit/GIOP/giop-types.h   2003-10-27 
17:14:12.000000000 +0100
+++ orbit2-2.14.0/include/orbit/GIOP/giop-types.h       2006-10-01 
02:17:46.000000000 +0200
@@ -104,6 +104,7 @@
   IOP_ServiceContextList service_context;
   CORBA_unsigned_long request_id;
   CORBA_boolean response_expected;
+  CORBA_char reserved[3];
   CORBA_sequence_CORBA_octet object_key;
   CORBA_char *operation;
   CORBA_Principal requesting_principal;
diff -ur orbit2-2.14.0.org/src/orb/GIOP/giop-recv-buffer.c 
orbit2-2.14.0/src/orb/GIOP/giop-recv-buffer.c
--- orbit2-2.14.0.org/src/orb/GIOP/giop-recv-buffer.c   2006-03-08 
13:03:54.000000000 +0100
+++ orbit2-2.14.0/src/orb/GIOP/giop-recv-buffer.c       2006-09-30 
14:35:14.000000000 +0200
@@ -423,6 +423,14 @@
 giop_recv_buffer_use_encaps (guchar *mem, gulong len)
 {
        GIOPRecvBuffer *buf = giop_recv_buffer_use_buf (NULL);
+       gboolean free_body = FALSE;
+
+       if (ALIGN_ADDRESS (mem, 4) != mem) {
+               guchar *mem2 = g_malloc (len);
+               memcpy (mem2, mem, len);
+               mem = mem2;
+               free_body = TRUE;
+       }
 
        buf->cur = buf->message_body = mem;
        buf->end = buf->cur + len;
@@ -431,7 +439,7 @@
        buf->giop_version = GIOP_LATEST;
        buf->left_to_read = 0;
        buf->state = GIOP_MSG_READY;
-       buf->free_body = FALSE;
+       buf->free_body = free_body;
 
        return buf;
 }
diff -ur orbit2-2.14.0.org/src/orb/orb-core/corba-orb.c 
orbit2-2.14.0/src/orb/orb-core/corba-orb.c
--- orbit2-2.14.0.org/src/orb/orb-core/corba-orb.c      2005-11-17 
15:41:55.000000000 +0100
+++ orbit2-2.14.0/src/orb/orb-core/corba-orb.c  2006-09-29 14:16:52.000000000 
+0200
@@ -392,7 +392,7 @@
                return ORBit_RootObject_duplicate (retval);
 
        /* the allocation code uses the bottom bit of any pointer */
-       g_assert (ORBIT_ALIGNOF_CORBA_DOUBLE > 2);
+       g_assert (ORBIT_ALIGNOF_CORBA_DOUBLE >= 2);
 
        if (orb_identifier &&
            strstr (orb_identifier, "orbit-local-non-threaded-orb") != NULL)

Reply via email to