[systemd-commits] 2 commits - Makefile.am src/libsystemd-bus

Lennart Poettering lennart at kemper.freedesktop.org
Wed Dec 4 18:19:38 PST 2013


 Makefile.am                            |    4 +++-
 src/libsystemd-bus/DIFFERENCES         |   26 ++++++++++++++++++++++++++
 src/libsystemd-bus/bus-message.c       |   18 +++++++++---------
 src/libsystemd-bus/test-bus-gvariant.c |    2 +-
 4 files changed, 39 insertions(+), 11 deletions(-)

New commits:
commit bc25a2fb66ebf14589bb7ce5ecbd35301ee484ac
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Dec 5 03:16:15 2013 +0100

    bus: start maintaining a list of difference between kdbus/dbus1

diff --git a/Makefile.am b/Makefile.am
index 194aaa8..7bedd76 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2027,7 +2027,9 @@ pkgconfiglib_DATA += \
 	src/libsystemd-bus/libsystemd-bus.pc
 
 EXTRA_DIST += \
-	src/libsystemd-bus/libsystemd-bus.pc.in
+	src/libsystemd-bus/libsystemd-bus.pc.in \
+	src/libsystemd-bus/DIFFERENCES \
+	src/libsystemd-bus/GVARIANT-SERIALIZATION
 
 lib_LTLIBRARIES += \
 	libsystemd-bus.la
diff --git a/src/libsystemd-bus/DIFFERENCES b/src/libsystemd-bus/DIFFERENCES
new file mode 100644
index 0000000..1c2bf99
--- /dev/null
+++ b/src/libsystemd-bus/DIFFERENCES
@@ -0,0 +1,26 @@
+Known differences between dbus1 and kdbus:
+
+- NameAcquired/NameLost is gone entirely on kdbus backends if
+  libsystemd-bus is used. It is still added in by systemd-bus-proxyd
+  for old dbus1 clients, and it is available if libsystemd-bus is used
+  against the classic dbus1 daemon. If you want to write compatible
+  code with libsystem-bus you need to explicitly subscribe to
+  NameOwnerChanged signals and just ignore NameAcquired/NameLost
+
+- Applications have to deal with spurious signals they didn't expect,
+  due to the probabilistic bloom filters. They need to handle this
+  anyway, given that any client can send anything to arbitrary clients
+  anyway, even in dbus1, so not much changes.
+
+- clients of the system bus when kdbus is used must roll their own
+  security. Only legacy dbus1 clients get the old XML policy enforced,
+  which is implemented by systemd-bus-proxyd.
+
+- Serial numbers of synthesized messages are always (uint32_t) -1.
+
+- The org.freedesktop.DBus "driver" service is not special on
+  kdbus. It is a bus activated service like any other with its own
+  unique name.
+
+- NameOwnerChanged is a synthetic message, generated locally and not
+  by the driver.

commit ea6ad56836bcbb09038eb1c0912e97dc8686b1d8
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Dec 5 03:09:09 2013 +0100

    bus: add missing LE meta data enforcement for gvariant serializer

diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 73b0bab..4c0e27f 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -1912,7 +1912,7 @@ static int bus_message_close_array(sd_bus_message *m, struct bus_container *c) {
                                 return -ENOMEM;
 
                         for (i = 0; i < c->n_offsets; i++) {
-                                uint16_t x = (uint16_t) (c->offsets[i] - c->begin);
+                                uint16_t x = htole16((uint16_t) (c->offsets[i] - c->begin));
                                 memcpy(a + (i*2), &x, 2);
                         }
 
@@ -1922,7 +1922,7 @@ static int bus_message_close_array(sd_bus_message *m, struct bus_container *c) {
                                 return -ENOMEM;
 
                         for (i = 0; i < c->n_offsets; i++) {
-                                uint32_t x = (uint32_t) (c->offsets[i] - c->begin);
+                                uint32_t x = htole32((uint32_t) (c->offsets[i] - c->begin));
                                 memcpy(a + (i*4), &x, 4);
                         }
                 } else {
@@ -1931,7 +1931,7 @@ static int bus_message_close_array(sd_bus_message *m, struct bus_container *c) {
                                 return -ENOMEM;
 
                         for (i = 0; i < c->n_offsets; i++) {
-                                uint64_t x = (uint64_t) (c->offsets[i] - c->begin);
+                                uint64_t x = htole64((uint64_t) (c->offsets[i] - c->begin));
                                 memcpy(a + (i*8), &x, 8);
                         }
                 }
@@ -2054,13 +2054,13 @@ static int bus_message_close_struct(sd_bus_message *m, struct bus_container *c,
                         if (z == 1)
                                 ((uint8_t*) a)[k] = (uint8_t) v;
                         else if (z == 2) {
-                                uint16_t x = (uint16_t) v;
+                                uint16_t x = htole16((uint16_t) v);
                                 memcpy(a + k * 2, &x, 2);
                         } else if (z == 4) {
-                                uint32_t x = (uint32_t) v;
+                                uint32_t x = htole32((uint32_t) v);
                                 memcpy(a + k * 4, &x, 4);
                         } else if (z == 8) {
-                                uint64_t x = (uint64_t) v;
+                                uint64_t x = htole64((uint64_t) v);
                                 memcpy(a + k * 8, &x, 8);
                         } else
                                 assert_not_reached("Wrong offset width");
@@ -4392,13 +4392,13 @@ static int bus_message_close_header(sd_bus_message *m) {
                 if (z == 1)
                         ((uint8_t*) a)[i] = (uint8_t) m->header_offsets[i];
                 else if (z == 2) {
-                        uint16_t x = (uint16_t) m->header_offsets[i];
+                        uint16_t x = htole16((uint16_t) m->header_offsets[i]);
                         memcpy(a + 2*i, &x, 2);
                 } else if (z == 4) {
-                        uint32_t x = (uint32_t) m->header_offsets[i];
+                        uint32_t x = htole32((uint32_t) m->header_offsets[i]);
                         memcpy(a + 4*i, &x, 4);
                 } else if (z == 8) {
-                        uint64_t x = (uint64_t) m->header_offsets[i];
+                        uint64_t x = htole64((uint64_t) m->header_offsets[i]);
                         memcpy(a + 8*i, &x, 8);
                 } else
                         assert_not_reached("unknown type");
diff --git a/src/libsystemd-bus/test-bus-gvariant.c b/src/libsystemd-bus/test-bus-gvariant.c
index a5f8a17..9888e33 100644
--- a/src/libsystemd-bus/test-bus-gvariant.c
+++ b/src/libsystemd-bus/test-bus-gvariant.c
@@ -89,7 +89,7 @@ static void test_marshal(void) {
         assert_se(sd_bus_open_system(&bus) >= 0);
         bus->use_gvariant = true; /* dirty hack */
 
-        assert_se(sd_bus_message_new_method_call(bus, "a.service.name", "/an/object/path", "an.interface.name", "AMethodName", &m) >= 0);
+        assert_se(sd_bus_message_new_method_call(bus, "a.service.name", "/an/object/path/which/is/really/really/long/so/that/we/hit/the/eight/bit/boundary/by/quite/some/margin/to/test/this/stuff/that/it/really/works", "an.interface.name", "AMethodName", &m) >= 0);
 
         /* assert_se(sd_bus_message_append(m, "ssy(sts)v", "first-string-parameter", "second-string-parameter", 9, "a", (uint64_t) 7777, "b", "(su)", "xxx", 4712) >= 0);  */
         assert_se(sd_bus_message_append(m,



More information about the systemd-commits mailing list