From 29a743f99346ca0eae0fbf7389307bad873fb1be Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 26 Nov 2019 11:33:08 +0100 Subject: [PATCH 1/3] core: explicit mention of unit ID is redundant with log_unit_*() --- src/core/unit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/unit.c b/src/core/unit.c index 399a8cf655..86ed535ba5 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -5318,7 +5318,7 @@ static void unit_update_dependency_mask(Unit *u, UnitDependency d, Unit *other, if (di.origin_mask == 0 && di.destination_mask == 0) { /* No bit set anymore, let's drop the whole entry */ assert_se(hashmap_remove(u->dependencies[d], other)); - log_unit_debug(u, "%s lost dependency %s=%s", u->id, unit_dependency_to_string(d), other->id); + log_unit_debug(u, "lost dependency %s=%s", unit_dependency_to_string(d), other->id); } else /* Mask was reduced, let's update the entry */ assert_se(hashmap_update(u->dependencies[d], other, di.data) == 0); From 66a19d85a533b15ed32f4066ec880b5a8c06babd Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Mon, 25 Nov 2019 16:05:56 +0100 Subject: [PATCH 2/3] shared/install: try harder to find enablement symlinks when disabling a unit It might be needed to follow symlinks more deeply when we're looking for enablement symlinks pointing to the removed service. Let's consider the case where service 'old' is being renamed 'new' (will happen most likely during package upgrade). Before the service is going to be renamed, there's the following enablement symlink: /etc/systemd/system/multi-user.target.wants/old.service -> /usr/lib/systemd/system/old.service In order to rename 'old' into 'new' and transparently restart the service, the old name is still provided as a 'static' alias for the new service. This should also help keeping backward compatibilities since the old name might still be embedded in unit files, scripts, generators and such. Hence after the package is upgraded, the following symlinks including the enablement symlink are present: /usr/lib/systemd/system/old.service -> new.service /etc/systemd/system/multi-user.target.wants/old.service -> /usr/lib/systemd/system/old.service If later the user decides to disable the service, we should figure out that the enablement symlink (which still has the old name) is actually referring to 'new' (indirectly) even if it points to the alias. --- src/shared/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/install.c b/src/shared/install.c index 0e673b3358..cc628d7369 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -585,7 +585,7 @@ static int remove_marked_symlinks_fd( return -ENOMEM; path_simplify(p, false); - q = readlink_malloc(p, &dest); + q = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &dest, NULL); if (q == -ENOENT) continue; if (q < 0) { From 972f3176fa3606cfe50f469814225f73d475733f Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Thu, 28 Nov 2019 17:46:42 +0100 Subject: [PATCH 3/3] shared/install: drop an unused variable in config_parse_also() --- src/shared/install.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/install.c b/src/shared/install.c index cc628d7369..1e5babcddf 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1122,7 +1122,7 @@ static int config_parse_also( void *data, void *userdata) { - UnitFileInstallInfo *info = userdata, *alsoinfo = NULL; + UnitFileInstallInfo *info = userdata; InstallContext *c = data; int r; @@ -1144,7 +1144,7 @@ static int config_parse_also( if (r < 0) return r; - r = install_info_add(c, printed, NULL, true, &alsoinfo); + r = install_info_add(c, printed, NULL, true, NULL); if (r < 0) return r;