[systemd-devel] [PATCH] install: Assume *.wants symlinks have the same name as their target for scalability.

Lennart Poettering lennart at poettering.net
Thu Dec 12 06:23:25 PST 2013


On Wed, 11.12.13 15:54, david at davidstrauss.net (david at davidstrauss.net) wrote:

> From: David Strauss <david at davidstrauss.net>
> 
> ---
>  src/shared/install.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/shared/install.c b/src/shared/install.c
> index 17e8a75..14c0f4b 100644
> --- a/src/shared/install.c
> +++ b/src/shared/install.c
> @@ -423,6 +423,11 @@ static int find_symlinks_fd(
>                          bool found_path, found_dest, b = false;
>                          int q;
>  
> +                        /* Skip symlinks with a different basename than
> +                         * the target unit */
> +                        if (!streq(basename(de->d_name), name))
> +                                continue;
> +
>                          /* Acquire symlink name */
>                          p = path_make_absolute(de->d_name, path);
>                          if (!p)

This isn't right. Units might be symlinked under different names, we
need to support that. For example, all template instances carry a
different name for the symlink then for the source.

We need to find a different solution here. Maybe introduce a cache
object or so where we load everything we find in too and that can be
indexed by the target rather then the name of a symlink.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list