[systemd-devel] [PATCH] timer: order OnCalendar units after timer-sync.target if DefaultDependencies=no

Lennart Poettering lennart at poettering.net
Mon Aug 4 11:05:37 PDT 2014

On Mon, 04.08.14 19:31, Tobias Geerinckx-Rice (tobias.geerinckx.rice at gmail.com) wrote:

>                  <para>Unless <varname>DefaultDependencies=</varname>
>                  is set to <option>false</option>, timer units will
>                  implicitly have dependencies of type
> +                <varname>After=</varname> on
> +                <filename>timer-sync.target</filename>, and of type

Well, this is misleading. Non-calendar timers should not and according
to your patch will not get the dependency, this should be
clarified. Adding in brackets a "(only if at least one calendar time
specification is declared)" should suffice. 

> +
> +                if (t->values->base == TIMER_CALENDAR) {
> +                        r = unit_add_dependency_by_name(UNIT(t), UNIT_AFTER, SPECIAL_TIME_SYNC_TARGET, NULL, true);
> +                        if (r < 0)
> +                                return r;
> +                }

To be fully correct we should iterate through the list, and do this when
at least one entry if base TIMER_CALENDAR is found. 

Otherwise looks good.



Lennart Poettering, Red Hat

More information about the systemd-devel mailing list