diff options
author | Felipe Sateler <fsateler@users.noreply.github.com> | 2016-11-06 11:16:42 -0300 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-06 09:16:42 -0500 |
commit | b05422a8cf87c95e8fc801add5349b3f5d027f66 (patch) | |
tree | d2fcdeabd7f86b9f95dd6a4915fce2afbe367303 | |
parent | 9bda42660d25da05210bd11e482a8e02c4e6b326 (diff) |
delta: skip symlink paths when split-usr is enabled (#4591)
If systemd is built with --enable-split-usr, but the system is indeed a
merged-usr system, then systemd-delta gets all confused and reports
that all units and configuration files have been overridden.
Skip any prefix paths that are symlinks in this case.
Fixes: #4573
-rw-r--r-- | src/delta/delta.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/delta/delta.c b/src/delta/delta.c index 6848662ccb..04de75475d 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -355,6 +355,21 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch } } +static int should_skip_prefix(const char* p) { +#ifdef HAVE_SPLIT_USR + int r; + _cleanup_free_ char *target = NULL; + + r = chase_symlinks(p, NULL, &target); + if (r < 0) + return r; + + return !streq(p, target) && nulstr_contains(prefixes, target); +#else + return 0; +#endif +} + static int process_suffix(const char *suffix, const char *onlyprefix) { const char *p; char *f; @@ -382,6 +397,15 @@ static int process_suffix(const char *suffix, const char *onlyprefix) { NULSTR_FOREACH(p, prefixes) { _cleanup_free_ char *t = NULL; + int skip; + + skip = should_skip_prefix(p); + if (skip < 0) { + r = skip; + goto finish; + } + if (skip) + continue; t = strjoin(p, "/", suffix); if (!t) { @@ -459,6 +483,13 @@ static int process_suffix_chop(const char *arg) { /* Strip prefix from the suffix */ NULSTR_FOREACH(p, prefixes) { const char *suffix; + int skip; + + skip = should_skip_prefix(p); + if (skip < 0) + return skip; + if (skip) + continue; suffix = startswith(arg, p); if (suffix) { |