Fix systemctl set-default

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-10-07 07:25:26 -04:00
parent 839ccebd9b
commit 64282b85b2
20 changed files with 35 additions and 56 deletions

View File

@ -31,6 +31,3 @@ index 6a0ed79a53..6e61eeadef 100644
if (!isempty(arg_root)) if (!isempty(arg_root))
argv[c++] = q = strappend("--root=", arg_root); argv[c++] = q = strappend("--root=", arg_root);
--
2.9.0

View File

@ -24,6 +24,3 @@ index 348e396292..63363035e7 100644
k = system_tasks_max_scale(r, 100U); k = system_tasks_max_scale(r, 100U);
else { else {
--
2.9.0

View File

@ -38,6 +38,3 @@ index 95ec9bc8a0..a3ca617256 100644
[Path] [Path]
DirectoryNotEmpty=/run/systemd/ask-password DirectoryNotEmpty=/run/systemd/ask-password
--
2.9.0

View File

@ -32,6 +32,3 @@ index 8ef48dbaa1..a950409254 100644
if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) { if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) {
log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_key)); log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_key));
return 0; return 0;
--
2.9.0

View File

@ -107,6 +107,3 @@ index 5733e42cd1..f0bdb1c756 100644
<citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry> <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
PAM module.</para> PAM module.</para>
--
2.9.0

View File

@ -23,6 +23,3 @@ index 7b49e1ece9..2d9306058d 100644
do { do {
int q, cfd; int q, cfd;
--
2.9.0

View File

@ -72,6 +72,3 @@ index 2d9306058d..5e0f9c5d0c 100644
if (r == -ERFKILL) if (r == -ERFKILL)
r = unit_file_changes_add(changes, n_changes, r = unit_file_changes_add(changes, n_changes,
UNIT_FILE_IS_MASKED, de->d_name, NULL); UNIT_FILE_IS_MASKED, de->d_name, NULL);
--
2.9.0

View File

@ -81,6 +81,3 @@ index 5e0f9c5d0c..ef5a56391c 100644
r = query_presets(name, presets); r = query_presets(name, presets);
if (r < 0) if (r < 0)
return r; return r;
--
2.9.0

View File

@ -92,6 +92,3 @@ index 85a7b12d76..f818e772a9 100644
<para>Along with a unit file <filename>foo.service</filename>, the <para>Along with a unit file <filename>foo.service</filename>, the
directory <filename>foo.service.wants/</filename> may exist. All directory <filename>foo.service.wants/</filename> may exist. All
--
2.9.0

View File

@ -142,6 +142,3 @@ index ef5a56391c..8c45725f5a 100644
} }
int unit_file_get_default( int unit_file_get_default(
--
2.9.0

View File

@ -95,6 +95,3 @@ index 8c45725f5a..9ce8e4d390 100644
return 1; return 1;
if (!force) { if (!force) {
--
2.9.0

View File

@ -73,6 +73,3 @@ index 9ce8e4d390..9d9f4dff4f 100644
if (i->type != UNIT_FILE_TYPE_REGULAR) if (i->type != UNIT_FILE_TYPE_REGULAR)
continue; continue;
--
2.9.0

View File

@ -43,6 +43,3 @@ index f2adca7d2b..f59a55f166 100644
for (j = 1, i = 1; j < (unsigned) argc; j++) for (j = 1, i = 1; j < (unsigned) argc; j++)
args[i++] = argv[j]; args[i++] = argv[j];
args[i++] = NULL; args[i++] = NULL;
--
2.9.0

View File

@ -60,6 +60,3 @@ index df56d85317..47d31ad4d7 100644
else else
enabled = !terminal_is_dumb(); enabled = !terminal_is_dumb();
} }
--
2.9.0

View File

@ -125,6 +125,3 @@ index 9d9f4dff4f..cb2a2e7e0d 100644
r += 1; r += 1;
continue; continue;
} }
--
2.9.0

View File

@ -27,6 +27,3 @@ index 4d84a0b37e..a085ed899a 100644
CMSG_FOREACH(cmsg, &msghdr) { CMSG_FOREACH(cmsg, &msghdr) {
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
--
2.9.0

View File

@ -46,6 +46,3 @@ index a085ed899a..36488b673a 100644
} }
} }
--
2.9.0

View File

@ -75,6 +75,3 @@ index 36488b673a..85bf858992 100644
found = true; found = true;
} }
--
2.9.0

View File

@ -0,0 +1,30 @@
From eadc5d94950a04f9fb64cb3906644af04de81970 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 10 Sep 2016 12:07:51 +0100
Subject: [PATCH] shared/install: fix set-default with empty root (#4118)
https://bugzilla.redhat.com/show_bug.cgi?id=1374371
When root was empty or equal to "/", chroot_symlinks_same was called with
root==NULL, and strjoina returned "", so the code thought both paths are equal
even if they were not. Fix that by always providing a non-null first argument
to strjoina.
(cherry picked from commit ae9efab711e7478b4f035edd00824d518bcf0d3c)
---
src/shared/install.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/shared/install.c b/src/shared/install.c
index cb2a2e7e0d..cf1e8349d7 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -403,6 +403,9 @@ static bool chroot_symlinks_same(const char *root, const char *wd, const char *a
/* This will give incorrect results if the paths are relative and go outside
* of the chroot. False negatives are possible. */
+ if (!root)
+ root = "/";
+
a = strjoina(path_is_absolute(a) ? root : wd, "/", a);
b = strjoina(path_is_absolute(b) ? root : wd, "/", b);
return path_equal_or_files_same(a, b);

View File

@ -12,7 +12,7 @@
Name: systemd Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 231 Version: 231
Release: 8%{?gitcommit:.git%{gitcommitshort}}%{?dist} Release: 9%{?gitcommit:.git%{gitcommitshort}}%{?dist}
# For a breakdown of the licensing, see README # For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+ License: LGPLv2+ and MIT and GPLv2+
Summary: A System and Service Manager Summary: A System and Service Manager
@ -54,7 +54,7 @@ Patch0015: 0015-shared-install-do-not-enable-masked-instances-4005.patch
Patch0016: 0016-If-the-notification-message-length-is-0-ignore-the-m.patch Patch0016: 0016-If-the-notification-message-length-is-0-ignore-the-m.patch
Patch0017: 0017-pid1-don-t-return-any-error-in-manager_dispatch_noti.patch Patch0017: 0017-pid1-don-t-return-any-error-in-manager_dispatch_noti.patch
Patch0018: 0018-pid1-process-zero-length-notification-messages-again.patch Patch0018: 0018-pid1-process-zero-length-notification-messages-again.patch
Patch0019: 0019-shared-install-fix-set-default-with-empty-root-4118.patch
Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch
@ -951,6 +951,9 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
%{_mandir}/man[1578]/systemd-nspawn.* %{_mandir}/man[1578]/systemd-nspawn.*
%changelog %changelog
* Fri Oct 7 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 231-9
- Fix systemctl set-default (#1374371)
* Tue Oct 4 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 231-8 * Tue Oct 4 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 231-8
- Apply fix for #1378974 - Apply fix for #1378974