diff --git a/src/shared/install.c b/src/shared/install.c index 8d4aa5ab2c..eaad368d1c 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -2875,7 +2875,7 @@ static int normalize_linked_files( return log_debug_errno(SYNTHETIC_ERRNO(EISDIR), "Unexpected path to a directory \"%s\", refusing.", *a); - if (!is_path(*a)) { + if (!is_path(*a) && !unit_name_is_valid(*a, UNIT_NAME_INSTANCE)) { r = install_info_discover(&ctx, lp, n, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, &i, NULL, NULL); if (r < 0) log_debug_errno(r, "Failed to discover unit \"%s\", operating on name: %m", n); diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh index 7d5667f297..7d82c38613 100644 --- a/test/test-systemctl-enable.sh +++ b/test/test-systemctl-enable.sh @@ -97,7 +97,7 @@ test ! -e "$root/etc/systemd/system/test1-badalias.target" test ! -e "$root/etc/systemd/system/test1-badalias.socket" test -h "$root/etc/systemd/system/test1-goodalias2.service" -: '-------aliases in reeanble----------------------------------' +: '-------aliases in reenable----------------------------------' ( ! "$systemctl" --root="$root" reenable test1 ) test -h "$root/etc/systemd/system/default.target.wants/test1.service" test ! -e "$root/etc/systemd/system/test1-goodalias.service" @@ -246,6 +246,29 @@ islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path" islink "$root/etc/systemd/system/link1.path" "/link1.path" islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path" +: '-------link instance and enable-------------------------------------' +cat >"$root/link-instance@.service" <"$root/link3.suffix" <