Re: [systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-02-04 Thread Lennart Poettering
On Wed, 29.01.14 19:37, Andrey Borzenkov (arvidj...@gmail.com) wrote:

  So, in order to understand DefaultDependencies, you need to read the
  related bits in systemd.unit(5), systemd.service(5), systemd.timer(5),
  systemd.socket(5), systemd.path(5), systemd.slice(5), systemd.swap(5)
  and systemd.target(5). The manpages systemd.mount(5) and
  systemd.automount(5) seem to lack any information about default
  dependencies.
  
 
 In theory you need just two of them - for two units in question, for
 which you try to understand why they have these specific relations.
 
  This is really annoying to learn - I'd suggest collecting all this
  information in one place - IMO, it belongs either into systemd.unit(5)
  or into its own manpage.
  
 
 Actually I think having default dependency for a unit type in the man
 page for this unit type is logical. May be some magic to auto-generate
 cross-reference man page would be nice. Maintaining this manually is
 too error prone.

Yeah, I agree, this belongs in the individual type-specific man pages,
whith maybe a longer discussion what this is about next to the generic
DefaultDependencies= setting in systemd.unit(5), with hints that the
precise rules are documented in the indiviudal pages...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-01-29 Thread Thomas Bächler
Am 29.01.2014 03:49, schrieb Andrey Borzenkov:
 Zbyszek's argument for the patch, however, is that following the
 recommended WantedBy= behavior already applies the same Before=
 dependency,
 
 Where is *this* documented? Unless I misunderstand what you say.

The documentation (and code) regarding the sometimes unexpected
behaviour of DefaultDependencies is scattered in a few places - this
cost me some time when I first learned how to systemd.

From systemd.unit(5):
 If true, (the default), a few default dependencies will implicitly be
 created for the unit. The actual dependencies created depend on the
 unit type.

Now, it is true that when you look at systemd.service(5) and friends,
there is no mention of this implicit Before= dependency mentioned above.
Even when you look at the code, you won't find it directly.

Eventually, you'll find this bit in systemd.target(5):
 Unless DefaultDependencies= is set to false, target units will
 implicitly complement all configured dependencies of type Wants=,
 Requires=, RequiresOverridable= with dependencies of type After= if
 the units in question also have DefaultDependencies=true

So, in order to understand DefaultDependencies, you need to read the
related bits in systemd.unit(5), systemd.service(5), systemd.timer(5),
systemd.socket(5), systemd.path(5), systemd.slice(5), systemd.swap(5)
and systemd.target(5). The manpages systemd.mount(5) and
systemd.automount(5) seem to lack any information about default
dependencies.

This is really annoying to learn - I'd suggest collecting all this
information in one place - IMO, it belongs either into systemd.unit(5)
or into its own manpage.




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-01-29 Thread Lennart Poettering
On Tue, 28.01.14 13:12, da...@davidstrauss.net (da...@davidstrauss.net) wrote:

 From: David Strauss da...@davidstrauss.net

What's the rationale here?

Documenting what DEfaultDependencies= does is something that has been on
the todo list since a long time, we really should document this.

 
 ---
  src/core/path.c   | 5 -
  src/core/socket.c | 4 
  src/core/timer.c  | 4 
  3 files changed, 13 deletions(-)
 
 diff --git a/src/core/path.c b/src/core/path.c
 index fc7069e..95ed015 100644
 --- a/src/core/path.c
 +++ b/src/core/path.c
 @@ -336,11 +336,6 @@ static int path_add_default_dependencies(Path *p) {
  
  assert(p);
  
 -r = unit_add_dependency_by_name(UNIT(p), UNIT_BEFORE,
 -SPECIAL_PATHS_TARGET, NULL, true);
 -if (r  0)
 -return r;
 -
  if (UNIT(p)-manager-running_as == SYSTEMD_SYSTEM) {
  r = unit_add_two_dependencies_by_name(UNIT(p), UNIT_AFTER, 
 UNIT_REQUIRES,

 SPECIAL_SYSINIT_TARGET, NULL, true);
 diff --git a/src/core/socket.c b/src/core/socket.c
 index 7eac0eb..4917185 100644
 --- a/src/core/socket.c
 +++ b/src/core/socket.c
 @@ -283,10 +283,6 @@ static int socket_add_default_dependencies(Socket *s) {
  int r;
  assert(s);
  
 -r = unit_add_dependency_by_name(UNIT(s), UNIT_BEFORE, 
 SPECIAL_SOCKETS_TARGET, NULL, true);
 -if (r  0)
 -return r;
 -
  if (UNIT(s)-manager-running_as == SYSTEMD_SYSTEM) {
  r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, 
 UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
  if (r  0)
 diff --git a/src/core/timer.c b/src/core/timer.c
 index a4ff662..ae7a07f 100644
 --- a/src/core/timer.c
 +++ b/src/core/timer.c
 @@ -96,10 +96,6 @@ static int timer_add_default_dependencies(Timer *t) {
  
  assert(t);
  
 -r = unit_add_dependency_by_name(UNIT(t), UNIT_BEFORE, 
 SPECIAL_TIMERS_TARGET, NULL, true);
 -if (r  0)
 -return r;
 -
  if (UNIT(t)-manager-running_as == SYSTEMD_SYSTEM) {
  r = unit_add_two_dependencies_by_name(UNIT(t), UNIT_AFTER, 
 UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
  if (r  0)


Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-01-29 Thread Andrey Borzenkov
В Wed, 29 Jan 2014 10:16:06 +0100
Thomas Bächler tho...@archlinux.org пишет:

 Am 29.01.2014 03:49, schrieb Andrey Borzenkov:
  Zbyszek's argument for the patch, however, is that following the
  recommended WantedBy= behavior already applies the same Before=
  dependency,
  
  Where is *this* documented? Unless I misunderstand what you say.
 
 The documentation (and code) regarding the sometimes unexpected
 behaviour of DefaultDependencies is scattered in a few places - this
 cost me some time when I first learned how to systemd.
 
 From systemd.unit(5):
  If true, (the default), a few default dependencies will implicitly be
  created for the unit. The actual dependencies created depend on the
  unit type.
 
 Now, it is true that when you look at systemd.service(5) and friends,
 there is no mention of this implicit Before= dependency mentioned above.
 Even when you look at the code, you won't find it directly.
 
 Eventually, you'll find this bit in systemd.target(5):
  Unless DefaultDependencies= is set to false, target units will
  implicitly complement all configured dependencies of type Wants=,
  Requires=, RequiresOverridable= with dependencies of type After= if
  the units in question also have DefaultDependencies=true
 

Ah! of course. Thank you. Somehow amount of documentation in systemd
may also become a disadvantage :)

 So, in order to understand DefaultDependencies, you need to read the
 related bits in systemd.unit(5), systemd.service(5), systemd.timer(5),
 systemd.socket(5), systemd.path(5), systemd.slice(5), systemd.swap(5)
 and systemd.target(5). The manpages systemd.mount(5) and
 systemd.automount(5) seem to lack any information about default
 dependencies.
 

In theory you need just two of them - for two units in question, for
which you try to understand why they have these specific relations.

 This is really annoying to learn - I'd suggest collecting all this
 information in one place - IMO, it belongs either into systemd.unit(5)
 or into its own manpage.
 

Actually I think having default dependency for a unit type in the man
page for this unit type is logical. May be some magic to auto-generate
cross-reference man page would be nice. Maintaining this manually is
too error prone.


signature.asc
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-01-29 Thread David Timothy Strauss
On Wed, Jan 29, 2014 at 3:14 AM, Lennart Poettering
lenn...@poettering.net wrote:
 What's the rationale here?

Three possibilities for an *enabled* timer with DefaultDependencies=true:
 (1) WantedBy=timers.target, which redundantly adds
Before=timers.target (because DefaultDependencies already adds it)
 (2) WantedBy= and After=something-later-than-timers.target (like
multi-user.target), which creates a cycle systemd has to break (like
Before=timers.target combined with After=multi-user.target). This is
our use case, which we have because we want a timer to start at
multi-user.target completing.
 (3) WantedBy=something-earlier-than-timers.target (like
sysinit.target), which is transitively redundant because
Before=basic.target is already before timers.target

So, having Before=timers.target as a default dependency is either
redundant or cyclical/conflicting. These same arguments are true for
sockets and (probably) paths.

 Documenting what DEfaultDependencies= does is something that has been on
 the todo list since a long time, we really should document this.

Yes, and documentation is an alternative that I mentioned to the patch.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-01-28 Thread david
From: David Strauss da...@davidstrauss.net

---
 src/core/path.c   | 5 -
 src/core/socket.c | 4 
 src/core/timer.c  | 4 
 3 files changed, 13 deletions(-)

diff --git a/src/core/path.c b/src/core/path.c
index fc7069e..95ed015 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -336,11 +336,6 @@ static int path_add_default_dependencies(Path *p) {
 
 assert(p);
 
-r = unit_add_dependency_by_name(UNIT(p), UNIT_BEFORE,
-SPECIAL_PATHS_TARGET, NULL, true);
-if (r  0)
-return r;
-
 if (UNIT(p)-manager-running_as == SYSTEMD_SYSTEM) {
 r = unit_add_two_dependencies_by_name(UNIT(p), UNIT_AFTER, 
UNIT_REQUIRES,
   SPECIAL_SYSINIT_TARGET, 
NULL, true);
diff --git a/src/core/socket.c b/src/core/socket.c
index 7eac0eb..4917185 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -283,10 +283,6 @@ static int socket_add_default_dependencies(Socket *s) {
 int r;
 assert(s);
 
-r = unit_add_dependency_by_name(UNIT(s), UNIT_BEFORE, 
SPECIAL_SOCKETS_TARGET, NULL, true);
-if (r  0)
-return r;
-
 if (UNIT(s)-manager-running_as == SYSTEMD_SYSTEM) {
 r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, 
UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
 if (r  0)
diff --git a/src/core/timer.c b/src/core/timer.c
index a4ff662..ae7a07f 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -96,10 +96,6 @@ static int timer_add_default_dependencies(Timer *t) {
 
 assert(t);
 
-r = unit_add_dependency_by_name(UNIT(t), UNIT_BEFORE, 
SPECIAL_TIMERS_TARGET, NULL, true);
-if (r  0)
-return r;
-
 if (UNIT(t)-manager-running_as == SYSTEMD_SYSTEM) {
 r = unit_add_two_dependencies_by_name(UNIT(t), UNIT_AFTER, 
UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
 if (r  0)
-- 
1.8.5.3

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-01-28 Thread David Timothy Strauss
Alternatively, we should update the man pages to reflect what the
DefaultDependencies= option affects.

Zbyszek's argument for the patch, however, is that following the
recommended WantedBy= behavior already applies the same Before=
dependency, and anyone doing otherwise ought not to be subjected to a
possibly circular Before= dependency.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Drop Before=paths/sockets/timers.target from DefaultDependencies.

2014-01-28 Thread Andrey Borzenkov
В Tue, 28 Jan 2014 13:15:38 -0800
David Timothy Strauss da...@davidstrauss.net пишет:

 Alternatively, we should update the man pages to reflect what the
 DefaultDependencies= option affects.
 
 Zbyszek's argument for the patch, however, is that following the
 recommended WantedBy= behavior already applies the same Before=
 dependency,

Where is *this* documented? Unless I misunderstand what you say.
 
and anyone doing otherwise ought not to be subjected to a
 possibly circular Before= dependency.
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel