Bump to v21-1

Fixes a reload bug.
This commit is contained in:
Tom Gundersen 2019-05-02 16:37:12 +02:00
parent 283e44851e
commit 476dfa95ab
6 changed files with 6 additions and 421 deletions

View File

@ -1,152 +0,0 @@
From bde61c86ce9c33b40cee6f88a249c1c435445474 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Thu, 11 Apr 2019 12:46:51 +0200
Subject: [PATCH] Revert "bus/policy: define the type of the policy
serialization statically"
The preprocessor uses too much memory for this on some architectures.
Go back to doing the computation at run-time.
This reverts commit 7b2a8674c9cfd1f65b3e0097870a922b69f00172.
---
src/bus/policy.c | 110 +----------------------------------------------
1 file changed, 2 insertions(+), 108 deletions(-)
diff --git a/src/bus/policy.c b/src/bus/policy.c
index a4cf5a3..e8ae26f 100644
--- a/src/bus/policy.c
+++ b/src/bus/policy.c
@@ -3,7 +3,6 @@
*/
#include <c-dvar.h>
-#include <c-dvar-type.h>
#include <c-list.h>
#include <c-rbtree.h>
#include <c-stdaux.h>
@@ -15,112 +14,6 @@
#include "util/error.h"
#include "util/selinux.h"
-static const CDVarType policy_type[] = {
- C_DVAR_T_INIT(
- C_DVAR_T_TUPLE4(
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE2(
- C_DVAR_T_u,
- C_DVAR_T_TUPLE5(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE4(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_b,
- C_DVAR_T_s
- )
- ),
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE10(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_u,
- C_DVAR_T_u,
- C_DVAR_T_t,
- C_DVAR_T_t
- )
- ),
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE10(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_u,
- C_DVAR_T_u,
- C_DVAR_T_t,
- C_DVAR_T_t
- )
- )
- )
- )
- ),
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE4(
- C_DVAR_T_b,
- C_DVAR_T_u,
- C_DVAR_T_u,
- C_DVAR_T_TUPLE5(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE4(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_b,
- C_DVAR_T_s
- )
- ),
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE10(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_u,
- C_DVAR_T_u,
- C_DVAR_T_t,
- C_DVAR_T_t
- )
- ),
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE10(
- C_DVAR_T_b,
- C_DVAR_T_t,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_s,
- C_DVAR_T_u,
- C_DVAR_T_u,
- C_DVAR_T_t,
- C_DVAR_T_t
- )
- )
- )
- )
- ),
- C_DVAR_T_ARRAY(
- C_DVAR_T_TUPLE2(
- C_DVAR_T_s,
- C_DVAR_T_s
- )
- ),
- C_DVAR_T_b
- )
- )
-};
-
static PolicyXmit *policy_xmit_free(PolicyXmit *xmit) {
if (!xmit)
return NULL;
@@ -645,7 +538,8 @@ int policy_registry_import(PolicyRegistry *registry, CDVar *v) {
bool apparmor;
int r;
- c_dvar_read(v, "<(", policy_type);
+ /* XXX: provide the type */
+ c_dvar_read(v, "<(", NULL);
c_dvar_read(v, "[");
--
2.20.1

View File

@ -1,136 +0,0 @@
From b32683eff39160232879ba899947cd456b19be9e Mon Sep 17 00:00:00 2001
From: David Rheinsberg <david.rheinsberg@gmail.com>
Date: Wed, 17 Apr 2019 09:13:07 +0200
Subject: [PATCH] launch/service: fix state tracking
The 'state' field is currently used for 2 purposes: To track whether a
service was pushed into the broker, and to track whether a service was
found during reload. While both can be tracked in the same state, it
makes things overly complex and the current solution is definitely
wrong. We do not consider failing configuration-reloads, which happen
to leave the reload-tag untouched. In those cases, we trigger the wrong
assertion in the activation path.
This patch splits the state into separate booleans. One to track
whether or not a services was pushed into the broker ('running'),
and one as throw-away tag for reload tracking ('reload_tag'). Note that
the value of the reload-tag is only correct *DURING RELOADS*. It is
garbage at all other times. Do not verify it. It is solely meant to be
used by the launcher to track services across reloads!
Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
---
src/launch/launcher.c | 8 ++++----
src/launch/service.c | 12 +++++-------
src/launch/service.h | 9 ++-------
3 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/src/launch/launcher.c b/src/launch/launcher.c
index f6ac140..83c4495 100644
--- a/src/launch/launcher.c
+++ b/src/launch/launcher.c
@@ -715,8 +715,8 @@ static int launcher_load_service_file(Launcher *launcher, const char *path, cons
} else {
Service *old_service = c_container_of(parent, Service, rb_by_name);
- if (old_service->state == SERVICE_STATE_DEFUNCT) {
- old_service->state = SERVICE_STATE_CURRENT;
+ if (!old_service->reload_tag) {
+ old_service->reload_tag = true;
r = service_update(old_service, path, unit, argc, argv, user, uid);
if (r)
return error_trace(r);
@@ -802,7 +802,7 @@ static int launcher_remove_services(Launcher *launcher) {
int r;
c_rbtree_for_each_entry_safe(service, service_safe, &launcher->services, rb) {
- if (service->state != SERVICE_STATE_DEFUNCT)
+ if (service->reload_tag)
continue;
r = service_remove(service);
@@ -1159,7 +1159,7 @@ static int launcher_reload_config(Launcher *launcher) {
return error_origin(r);
c_rbtree_for_each_entry(service, &launcher->services, rb)
- service->state = SERVICE_STATE_DEFUNCT;
+ service->reload_tag = false;
r = nss_cache_populate(&nss_cache);
if (r)
diff --git a/src/launch/service.c b/src/launch/service.c
index 91d9200..726dcce 100644
--- a/src/launch/service.c
+++ b/src/launch/service.c
@@ -503,7 +503,7 @@ int service_activate(Service *service) {
return 0;
}
- c_assert(service->state == SERVICE_STATE_CURRENT);
+ c_assert(service->running);
if (service->unit) {
r = service_start_unit(service);
@@ -523,7 +523,7 @@ int service_add(Service *service) {
_c_cleanup_(c_freep) char *object_path = NULL;
int r;
- if (service->state != SERVICE_STATE_PENDING)
+ if (service->running)
return 0;
r = asprintf(&object_path, "/org/bus1/DBus/Name/%s", service->id);
@@ -544,8 +544,7 @@ int service_add(Service *service) {
if (r < 0)
return error_origin(r);
- service->state = SERVICE_STATE_CURRENT;
-
+ service->running = true;
return 0;
}
@@ -554,7 +553,7 @@ int service_remove(Service *service) {
_c_cleanup_(c_freep) char *object_path = NULL;
int r;
- if (service->state == SERVICE_STATE_PENDING)
+ if (!service->running)
return 0;
r = asprintf(&object_path, "/org/bus1/DBus/Name/%s", service->id);
@@ -572,7 +571,6 @@ int service_remove(Service *service) {
if (r < 0)
return error_origin(r);
- service->state = SERVICE_STATE_PENDING;
-
+ service->running = false;
return 0;
}
diff --git a/src/launch/service.h b/src/launch/service.h
index 09f32ec..14bf928 100644
--- a/src/launch/service.h
+++ b/src/launch/service.h
@@ -12,16 +12,11 @@
typedef struct Service Service;
-typedef enum {
- SERVICE_STATE_PENDING,
- SERVICE_STATE_CURRENT,
- SERVICE_STATE_DEFUNCT,
-} ServiceState;
-
struct Service {
Launcher *launcher;
- ServiceState state;
bool not_found;
+ bool running;
+ bool reload_tag;
sd_bus_slot *slot;
CRBNode rb;
CRBNode rb_by_name;
--
2.20.1

View File

@ -1,43 +0,0 @@
Submodule subprojects/c-stdaux 1bcec74..11930d2:
diff --git a/subprojects/c-stdaux/src/c-stdaux.h b/subprojects/c-stdaux/src/c-stdaux.h
index d305780..a02aed9 100644
--- a/subprojects/c-stdaux/src/c-stdaux.h
+++ b/subprojects/c-stdaux/src/c-stdaux.h
@@ -437,9 +437,10 @@ _Static_assert(_assertion, _message); \
* macro is used with constant expressions, the compiler will be able to
* optimize it away.
*/
-static inline void c_assert(bool expr_result) {
- assert(expr_result);
-}
+#define c_assert(_x) ({ \
+ const _c_unused_ bool c_assert_result = (_x); \
+ assert(c_assert_result && #_x); \
+ })
/**
* c_errno() - return valid errno
diff --git a/subprojects/c-stdaux/src/test-api.c b/subprojects/c-stdaux/src/test-api.c
index 31d4d54..fb50066 100644
--- a/subprojects/c-stdaux/src/test-api.c
+++ b/subprojects/c-stdaux/src/test-api.c
@@ -170,6 +170,11 @@ static void test_api_macros(void) {
c_assert(c_align_to(0, 0) == 0);
}
+ /* c_assert */
+ {
+ c_assert(true);
+ }
+
/* C_DEFINE_CLEANUP / C_DEFINE_DIRECT_CLEANUP */
{
int v = 0;
@@ -181,7 +186,6 @@ static void test_api_macros(void) {
static void test_api_functions(void) {
void *fns[] = {
- (void *)c_assert,
(void *)c_errno,
(void *)c_free,
(void *)c_close,

View File

@ -1,17 +1,13 @@
%global dbus_user_id 81
Name: dbus-broker
Version: 20
Release: 4%{?dist}
Version: 21
Release: 1%{?dist}
Summary: Linux D-Bus Message Broker
License: ASL 2.0
URL: https://github.com/bus1/dbus-broker
Source0: https://github.com/bus1/dbus-broker/releases/download/v%{version}/dbus-broker-%{version}.tar.xz
Patch0: 0001-units-system-add-messagebus-alias.patch
Patch1: 0001-Revert-bus-policy-define-the-type-of-the-policy-seri.patch
Patch2: 0001-launch-service-fix-state-tracking.patch
Patch3: assert.patch
Patch4: disable-c-dvar-type-test.patch
Provides: bundled(c-dvar) = 1
Provides: bundled(c-ini) = 1
Provides: bundled(c-list) = 3
@ -149,6 +145,9 @@ fi
%{_userunitdir}/dbus-broker.service
%changelog
* Thu May 2 2019 Tom Gundersen <teg@jklm.no> - 21-1
- Minor bugfixes related to config reload for #1704488
* Wed Apr 17 2019 Tom Gundersen <teg@jklm.no> - 20-4
- Fix assert due to failing reload #1700514

View File

@ -1,83 +0,0 @@
Submodule subprojects/c-dvar 4ca71be..7c0833f:
diff --git a/subprojects/c-dvar/src/test-api.c b/subprojects/c-dvar/src/test-api.c
index 17d4950..cb9a6ab 100644
--- a/subprojects/c-dvar/src/test-api.c
+++ b/subprojects/c-dvar/src/test-api.c
@@ -164,50 +164,6 @@ static void test_types(void) {
C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y
)),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE9(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y
- )),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE10(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y
- )),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE11(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y
- )),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE12(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y
- )),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE13(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y
- )),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE14(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y
- )),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE15(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y
- )),
- C_DVAR_T_INIT(C_DVAR_T_TUPLE16(
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y,
- C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y, C_DVAR_T_y
- )),
};
size_t i;
@@ -219,6 +175,25 @@ static void test_types(void) {
for (i = 0; i < sizeof(types) / sizeof(*types); ++i)
assert(types[i].element);
+
+ /* these stress the compiler too much to evaluate in test-suites */
+#if !defined(C_DVAR_T_TUPLE9)
+ assert(0);
+#elif !defined(C_DVAR_T_TUPLE10)
+ assert(0);
+#elif !defined(C_DVAR_T_TUPLE11)
+ assert(0);
+#elif !defined(C_DVAR_T_TUPLE12)
+ assert(0);
+#elif !defined(C_DVAR_T_TUPLE13)
+ assert(0);
+#elif !defined(C_DVAR_T_TUPLE14)
+ assert(0);
+#elif !defined(C_DVAR_T_TUPLE15)
+ assert(0);
+#elif !defined(C_DVAR_T_TUPLE16)
+ assert(0);
+#endif
}
int main(int argc, char **argv) {
Submodule subprojects/c-stdaux 1bcec74...11930d2 (commits not present)

View File

@ -1 +1 @@
SHA512 (dbus-broker-20.tar.xz) = e2b2dad63328a8324cd7f13e368e0c618addaee2107f33a0258e0ca06a77a9a9e0de394001497359764c88ccecda185e9c38db4c4ff8144573e79e7fb67e3cb9
SHA512 (dbus-broker-21.tar.xz) = b6db7bb9426bfce5ee46e9ef9fcfb0107f8d8fe9cd1fef3a18db33a2886cf6b67515a128ffe5d7e64fa6c9087d2fd3818bea2adf39532b38be638ae39d428e6b