core: fragments of masked units ought not be considered for NeedDaemonReload (#7060)

The units that are not loaded don't have dropin_paths set. This
currently results in units that have fragments to always have
NeedDaemonReload=true when masked:

  $ find {/usr/lib,/run/user/8086}/systemd/user/meh.service* |xargs ls -ld
  lrwxrwxrwx. 1 lkundrak lkundrak    9 Oct 11 11:19 /run/user/8086/systemd/user/meh.service -> /dev/null
  -rw-rw-r--. 1 root     root       49 Oct 11 10:16 /usr/lib/systemd/user/meh.service
  drwxrwxr-x. 2 root     root     4096 Oct 11 10:50 /usr/lib/systemd/user/meh.service.d
  -rw-rw-r--. 1 root     root      666 Oct 11 10:50 /usr/lib/systemd/user/meh.service.d/override.conf
  $ systemctl --user daemon-reload
  $ busctl --user get-property org.freedesktop.systemd1 \
        /org/freedesktop/systemd1/unit/meh_2eservice \
        org.freedesktop.systemd1.Unit NeedDaemonReload
  b true
This commit is contained in:
Lubomir Rintel 2017-10-18 08:38:50 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 895265ad7d
commit 19a44dfe45

View file

@ -3485,7 +3485,8 @@ bool unit_need_daemon_reload(Unit *u) {
if (fragment_mtime_newer(u->source_path, u->source_mtime, false))
return true;
(void) unit_find_dropin_paths(u, &t);
if (u->load_state == UNIT_LOADED)
(void) unit_find_dropin_paths(u, &t);
if (!strv_equal(u->dropin_paths, t))
return true;