Skip to content

Commit a69f65d

Browse files
fbuihuukeszybz
authored andcommitted
systemctl: remove duplicate entries showed by list-dependencies (systemd#5049)
When a unit is part of several dependency constraints of another unit, list-dependencies repeats the name of the dependency for each dep constraint the unit is encountered. For example: $ systemctl cat test-main.target # /etc/systemd/system/test-main.target [Unit] Description=Main Target $ systemctl cat test.target [Unit] Description=Sub target PartOf=test-main.target [Install] WantedBy=test-main.target $ systemctl enable test.target Created symlink from /etc/systemd/system/test-main.target.wants/test.target to /etc/systemd/system/test.target. $ systemctl show test-main.target | grep test.target Wants=test.target ConsistsOf=test.target [...] $ systemctl list-dependencies test-main.target test-main.target ● ├─test.target ● └─test.target With this patch applied, dependencies are shown only once.
1 parent 5aac0be commit a69f65d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/systemctl/systemctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,7 @@ static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, cha
17341734
if (r < 0)
17351735
return bus_log_parse_error(r);
17361736

1737-
*deps = ret;
1737+
*deps = strv_uniq(ret);
17381738
ret = NULL;
17391739

17401740
return 0;

0 commit comments

Comments
 (0)