Hey Zbigniew, all,

Martin Pitt [2015-03-05 10:20 +0100]:
> As per tmpfiles.d(5), the first match should win if there are several
> tmpfiles.d lines for the same directory. Our rsyslog package ships a
> /usr/lib/tmpfiles.d/00rsyslog.conf which sets /var/log to 0775, so
> that it can write into it as the "syslog" system user. But now the
> permissions of /var/log are 0755 as /usr/lib/tmpfiles.d/var.conf
> overwrites it.

The attached patch helps and generally seems to behave fine. But I'd
really like Zbigniew to review/ack this, I'm not entirely sure whether
aborting on the first match is actually correct, or whether we need to
look at the other items in the array still for some reason.

Thanks,

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
From bae7be365da60db7086a93e7a9cbce7aa2cd0c07 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.p...@ubuntu.com>
Date: Thu, 5 Mar 2015 14:58:56 +0100
Subject: [PATCH] tmpfiles: Fix handling of duplicate lines

Commit 3f93da987 accidentally dropped the "return 0" after detection of a
duplicate line. Put it back, to get back the documented and intended "first
match wins" behaviour.

https://launchpad.net/bugs/1428540
---
 src/tmpfiles/tmpfiles.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 917bb3c..652fe5f 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1746,9 +1746,11 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
                 unsigned n;
 
                 for (n = 0; n < existing->count; n++) {
-                        if (!item_compatible(existing->items + n, &i))
+                        if (!item_compatible(existing->items + n, &i)) {
                                 log_warning("[%s:%u] Duplicate line for path \"%s\", ignoring.",
                                             fname, line, i.path);
+                                return 0;
+                        }
                 }
         } else {
                 existing = new0(ItemArray, 1);
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

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

Reply via email to