We used to call

  systemd-tmpfiles --prefix=/dev --create --remove
  systemd-udevd
  systemd-tmpfiles --create --remove

which caused a bug:

The first call would create dead device nodes, udev would change
permissions on these nodes, before the second call to tmpfiles would
reset the permissions to what they used to be.

Instead allow negation in the prefix filtering, to restrict the
second call to apply to everything but /dev:

  systemd-tmpfiles --prefix=!/dev --create --remove

Fixes: <https://bugs.archlinux.org/task/36259>
Reported-by: Gaetan Bisson <[email protected]>
---
 src/tmpfiles/tmpfiles.c                 | 5 ++++-
 units/systemd-tmpfiles-setup.service.in | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index eae993e..9840bba 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1119,9 +1119,12 @@ static int parse_line(const char *fname, unsigned line, 
const char *buffer) {
 
         path_kill_slashes(i->path);
 
-        if (arg_prefix && !path_startswith(i->path, arg_prefix))
+        if (arg_prefix && arg_prefix[0] != '!' && !path_startswith(i->path, 
arg_prefix))
                 return 0;
 
+       if (arg_prefix && arg_prefix[0] == '!' && path_startswith(i->path, 
arg_prefix + 1))
+               return 0;
+
         if (user && !streq(user, "-")) {
                 const char *u = user;
 
diff --git a/units/systemd-tmpfiles-setup.service.in 
b/units/systemd-tmpfiles-setup.service.in
index 67c7d4a..c49ce51 100644
--- a/units/systemd-tmpfiles-setup.service.in
+++ b/units/systemd-tmpfiles-setup.service.in
@@ -21,4 +21,4 @@ ConditionDirectoryNotEmpty=|/run/tmpfiles.d
 [Service]
 Type=oneshot
 RemainAfterExit=yes
-ExecStart=@rootbindir@/systemd-tmpfiles --create --remove
+ExecStart=@rootbindir@/systemd-tmpfiles --prefix=!/dev --create --remove
-- 
1.8.3.3

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to