More patches

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2015-05-20 01:34:58 -04:00
parent 0a8e7e6c19
commit a48f80c6e3
32 changed files with 2390 additions and 0 deletions

View File

@ -0,0 +1,70 @@
From 22eade6dd8422ba6d044c265f0620e3ebb900320 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 5 May 2015 16:35:34 -0400
Subject: [PATCH] timedated: correctly set context on /etc/localtime
https://bugzilla.redhat.com/show_bug.cgi?id=1190377
(cherry picked from commit fad44453ec789f49529ea5244b2c2e4d5ad1d420)
---
src/shared/label.c | 18 ++++++++++++++++++
src/shared/label.h | 1 +
src/timedate/timedated.c | 4 +++-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/shared/label.c b/src/shared/label.c
index 82f10b21bd..7d0a6bc7ca 100644
--- a/src/shared/label.c
+++ b/src/shared/label.c
@@ -78,3 +78,21 @@ int symlink_label(const char *old_path, const char *new_path) {
return mac_smack_fix(new_path, false, false);
}
+
+int symlink_label_atomic(const char *old_path, const char *new_path) {
+ int r;
+
+ assert(old_path);
+ assert(new_path);
+
+ r = mac_selinux_create_file_prepare(new_path, S_IFLNK);
+ if (r < 0)
+ return r;
+
+ r = symlink_atomic(old_path, new_path);
+ mac_selinux_create_file_clear();
+ if (r < 0)
+ return r;
+
+ return mac_smack_fix(new_path, false, false);
+}
diff --git a/src/shared/label.h b/src/shared/label.h
index 8070bcb021..793596409b 100644
--- a/src/shared/label.h
+++ b/src/shared/label.h
@@ -28,3 +28,4 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
int mkdir_label(const char *path, mode_t mode);
int symlink_label(const char *old_path, const char *new_path);
+int symlink_label_atomic(const char *old_path, const char *new_path);
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index f2d23f34b1..01ab9c98c7 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -34,6 +34,7 @@
#include "clock-util.h"
#include "conf-files.h"
#include "path-util.h"
+#include "label.h"
#include "fileio-label.h"
#include "label.h"
#include "bus-util.h"
@@ -123,7 +124,8 @@ static int context_write_data_timezone(Context *c) {
if (!p)
return log_oom();
- r = symlink_atomic(p, "/etc/localtime");
+ mac_selinux_init("/etc");
+ r = symlink_label_atomic(p, "/etc/localtime");
if (r < 0)
return r;

View File

@ -0,0 +1,71 @@
From c10fe187879d57c4e2290abc7e3f1017a39357f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 20 May 2015 01:24:36 -0400
Subject: [PATCH] Revert "timedated: correctly set context on /etc/localtime"
This reverts commit 22eade6dd8422ba6d044c265f0620e3ebb900320.
This commit was never supposed to be pushed.
---
src/shared/label.c | 18 ------------------
src/shared/label.h | 1 -
src/timedate/timedated.c | 4 +---
3 files changed, 1 insertion(+), 22 deletions(-)
diff --git a/src/shared/label.c b/src/shared/label.c
index 7d0a6bc7ca..82f10b21bd 100644
--- a/src/shared/label.c
+++ b/src/shared/label.c
@@ -78,21 +78,3 @@ int symlink_label(const char *old_path, const char *new_path) {
return mac_smack_fix(new_path, false, false);
}
-
-int symlink_label_atomic(const char *old_path, const char *new_path) {
- int r;
-
- assert(old_path);
- assert(new_path);
-
- r = mac_selinux_create_file_prepare(new_path, S_IFLNK);
- if (r < 0)
- return r;
-
- r = symlink_atomic(old_path, new_path);
- mac_selinux_create_file_clear();
- if (r < 0)
- return r;
-
- return mac_smack_fix(new_path, false, false);
-}
diff --git a/src/shared/label.h b/src/shared/label.h
index 793596409b..8070bcb021 100644
--- a/src/shared/label.h
+++ b/src/shared/label.h
@@ -28,4 +28,3 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
int mkdir_label(const char *path, mode_t mode);
int symlink_label(const char *old_path, const char *new_path);
-int symlink_label_atomic(const char *old_path, const char *new_path);
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 01ab9c98c7..f2d23f34b1 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -34,7 +34,6 @@
#include "clock-util.h"
#include "conf-files.h"
#include "path-util.h"
-#include "label.h"
#include "fileio-label.h"
#include "label.h"
#include "bus-util.h"
@@ -124,8 +123,7 @@ static int context_write_data_timezone(Context *c) {
if (!p)
return log_oom();
- mac_selinux_init("/etc");
- r = symlink_label_atomic(p, "/etc/localtime");
+ r = symlink_atomic(p, "/etc/localtime");
if (r < 0)
return r;

View File

@ -0,0 +1,152 @@
From e083aeafc31469b302d14570b5c5eabfdea49098 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 28 Apr 2015 12:21:31 +0200
Subject: [PATCH] run: synchronously wait until the scope unit we create is
started
Otherwise it might happen that by the time PID 1 adds our process to the
scope unit the process might already have died, if the process is
short-running (such as an invocation to /bin/true).
https://bugs.freedesktop.org/show_bug.cgi?id=86520
(cherry picked from commit de158ed22db60e3a6654557fa4aa72f7248550af)
---
src/libsystemd/sd-bus/bus-util.c | 10 ++++++++++
src/libsystemd/sd-bus/bus-util.h | 1 +
src/run/run.c | 42 +++++++++++++++++++++++++++++++++-------
3 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index 52d4ebe611..427f9a583d 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -1785,6 +1785,16 @@ int bus_wait_for_jobs_add(BusWaitForJobs *d, const char *path) {
return set_put_strdup(d->jobs, path);
}
+int bus_wait_for_jobs_one(BusWaitForJobs *d, const char *path, bool quiet) {
+ int r;
+
+ r = bus_wait_for_jobs_add(d, path);
+ if (r < 0)
+ return log_oom();
+
+ return bus_wait_for_jobs(d, quiet);
+}
+
int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet) {
const char *type, *path, *source;
int r;
diff --git a/src/libsystemd/sd-bus/bus-util.h b/src/libsystemd/sd-bus/bus-util.h
index e8a97cef9e..0dc4e699b1 100644
--- a/src/libsystemd/sd-bus/bus-util.h
+++ b/src/libsystemd/sd-bus/bus-util.h
@@ -208,6 +208,7 @@ int bus_wait_for_jobs_new(sd_bus *bus, BusWaitForJobs **ret);
void bus_wait_for_jobs_free(BusWaitForJobs *d);
int bus_wait_for_jobs_add(BusWaitForJobs *d, const char *path);
int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet);
+int bus_wait_for_jobs_one(BusWaitForJobs *d, const char *path, bool quiet);
DEFINE_TRIVIAL_CLEANUP_FUNC(BusWaitForJobs*, bus_wait_for_jobs_free);
diff --git a/src/run/run.c b/src/run/run.c
index 0661b3bee9..0b03d8e40d 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -807,14 +807,20 @@ static int start_transient_scope(
char **argv) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
+ _cleanup_(bus_wait_for_jobs_freep) BusWaitForJobs *w = NULL;
_cleanup_strv_free_ char **env = NULL, **user_env = NULL;
- _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
_cleanup_free_ char *scope = NULL;
+ const char *object = NULL;
int r;
assert(bus);
assert(argv);
+ r = bus_wait_for_jobs_new(bus, &w);
+ if (r < 0)
+ return log_oom();
+
if (arg_unit) {
scope = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".scope");
if (!scope)
@@ -855,7 +861,7 @@ static int start_transient_scope(
if (r < 0)
return bus_log_create_error(r);
- r = sd_bus_call(bus, m, 0, &error, NULL);
+ r = sd_bus_call(bus, m, 0, &error, &reply);
if (r < 0) {
log_error("Failed to start transient scope unit: %s", bus_error_message(&error, -r));
return r;
@@ -915,8 +921,16 @@ static int start_transient_scope(
if (!env)
return log_oom();
+ r = sd_bus_message_read(reply, "o", &object);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = bus_wait_for_jobs_one(w, object, arg_quiet);
+ if (r < 0)
+ return r;
+
if (!arg_quiet)
- log_info("Running as unit %s.", scope);
+ log_info("Running scope as unit %s.", scope);
execvpe(argv[0], argv, env);
@@ -928,13 +942,19 @@ static int start_transient_timer(
char **argv) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
+ _cleanup_(bus_wait_for_jobs_freep) BusWaitForJobs *w = NULL;
_cleanup_free_ char *timer = NULL, *service = NULL;
+ const char *object = NULL;
int r;
assert(bus);
assert(argv);
+ r = bus_wait_for_jobs_new(bus, &w);
+ if (r < 0)
+ return log_oom();
+
if (arg_unit) {
switch(unit_name_to_type(arg_unit)) {
@@ -1035,15 +1055,23 @@ static int start_transient_timer(
if (r < 0)
return bus_log_create_error(r);
- r = sd_bus_call(bus, m, 0, &error, NULL);
+ r = sd_bus_call(bus, m, 0, &error, &reply);
if (r < 0) {
log_error("Failed to start transient timer unit: %s", bus_error_message(&error, -r));
return r;
}
- log_info("Running as unit %s.", timer);
+ r = sd_bus_message_read(reply, "o", &object);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = bus_wait_for_jobs_one(w, object, arg_quiet);
+ if (r < 0)
+ return r;
+
+ log_info("Running timer as unit %s.", timer);
if (argv[0])
- log_info("Will run as unit %s.", service);
+ log_info("Will run service as unit %s.", service);
return 0;
}

View File

@ -0,0 +1,32 @@
From ca55eafbf7df19ef8726ea2086477efd11308d2b Mon Sep 17 00:00:00 2001
From: Alberto Fanjul Alonso <albertofanjul@gmail.com>
Date: Tue, 28 Apr 2015 15:44:23 +0200
Subject: [PATCH] sysv-generator test: Fix assertion
(cherry picked from commit 230f04856647fcfb07d5658f4b8c1cb3557fa0d8)
---
test/sysv-generator-test.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
index 09f5c01762..509899e0a5 100644
--- a/test/sysv-generator-test.py
+++ b/test/sysv-generator-test.py
@@ -323,7 +323,7 @@ class SysvGeneratorTest(unittest.TestCase):
self.add_sysv('foo.sh', {'Provides': 'foo bar'})
err, results = self.run_generator()
# ensure we don't try to create a symlink to itself
- self.assertNotIn(err, 'itself')
+ self.assertNotIn('itself', err)
self.assertEqual(list(results), ['foo.service'])
self.assertEqual(results['foo.service'].get('Unit', 'Description'),
'LSB: test foo service')
@@ -361,7 +361,7 @@ class SysvGeneratorTest(unittest.TestCase):
['foo.bak.service', 'foo.old.service', 'foo.service'])
# ensure we don't try to create a symlink to itself
- self.assertNotIn(err, 'itself')
+ self.assertNotIn('itself', err)
self.assert_enabled('foo.service', [2, 3, 4, 5])
self.assert_enabled('foo.bak.service', [])

View File

@ -0,0 +1,24 @@
From 853f26c2820e6d1005201774a97d3014a5b02860 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 29 Apr 2015 12:04:16 +0200
Subject: [PATCH] man: avoid line break in url
(cherry picked from commit b53c3c2d24ed1398ee427139cd880b07bc35fa24)
---
man/os-release.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/man/os-release.xml b/man/os-release.xml
index 8f4ab10fed..4f57323d49 100644
--- a/man/os-release.xml
+++ b/man/os-release.xml
@@ -104,8 +104,7 @@
<para>For a longer rationale for <filename>os-release</filename>
please refer to the <ulink
- url="http://0pointer.de/blog/projects/os-release">Announcement of
- <filename>/etc/os-release</filename></ulink>.</para>
+ url="http://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para>
</refsect1>
<refsect1>

View File

@ -0,0 +1,72 @@
From c2f347ff929d790d35187b81adb41c5a92d32b12 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Wed, 29 Apr 2015 08:19:05 -0400
Subject: [PATCH] Add VARIANT as a standard value for /etc/os-release
Some distributions (such as Fedora) are using the VARIANT field to
indicate to select packages which of several default configurations
they should be using. For example, VARIANT=Server provides a
different default firewall configuration (blocking basically
everything but SSH and the management console) whereas
VARIANT=Workstation opens many other ports for application
compatibility.
By adding this patch to the manual pages, we can standardize on a
cross-distribution mechanism for accomplishing this.
Fedora implementation details are available at
https://fedoraproject.org/wiki/Packaging:Per-Product_Configuration
(David: drop double paranthesis)
(cherry picked from commit be7d0048ddda1e994f651e2825f96266d537d10d)
---
man/os-release.xml | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/man/os-release.xml b/man/os-release.xml
index 4f57323d49..4ca2e59706 100644
--- a/man/os-release.xml
+++ b/man/os-release.xml
@@ -273,6 +273,41 @@
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>VARIANT=</varname></term>
+
+ <listitem><para>
+ A string identifying a specific variant or edition of the
+ operating system suitable for presentation to the user. This
+ field may be used to inform the user that the configuration of
+ this system is subject to a specific divergent set of rules or
+ default configuration settings. This field is optional and may
+ not be implemented on all systems.
+ Examples:
+ <literal>VARIANT="Server Edition"</literal>,
+ <literal>VARIANT="Smart Refrigerator Edition"</literal>
+ Note: this field is for display purposes only. The
+ <varname>VARIANT_ID</varname> field should be used for making
+ programmatic decisions.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>VARIANT_ID=</varname></term>
+
+ <listitem><para>
+ A lower-case string (no spaces or other characters outside of
+ 0-9, a-z, ".", "_" and "-"), identifying a specific variant or
+ edition of the operating system. This may be interpreted by
+ other packages in order to determine a divergent default
+ configuration. This field is optional and may not be
+ implemented on all systems.
+ Examples:
+ <literal>VARIANT_ID=server</literal>,
+ <literal>VARIANT_ID=embedded</literal>
+ </para></listitem>
+ </varlistentry>
+
</variablelist>
<para>If you are reading this file from C code or a shell script

View File

@ -0,0 +1,41 @@
From 185aa53dbf2dc882940487b35fae6dccd5097466 Mon Sep 17 00:00:00 2001
From: Seth Jennings <sjenning@redhat.com>
Date: Tue, 5 May 2015 13:31:01 -0500
Subject: [PATCH] Fix permissions on /run/systemd/nspawn/locks
machined is getting an EACCES when trying to create the lock file for
images because the mode on /run/systemd/nspawn/locks is 0600.
mkdir("/run/systemd/nspawn/locks", 0600) = -1 EEXIST (File exists)
stat("/run/systemd/nspawn/locks", {st_mode=S_IFDIR|0600, st_size=40, ...}) = 0
open("/run/systemd/nspawn/locks/inode-41:256", O_RDWR|O_CREAT|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC, 0600) = -1 EACCES (Permission denied)
This commit adjusts the mode to 0700 to correct the issue.
(cherry picked from commit 7e7cddb22493642dad826ec42ac00979f40b2d17)
---
src/shared/machine-image.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 8d61507e84..c02ee814c4 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -601,7 +601,7 @@ int image_path_lock(const char *path, int operation, LockFile *global, LockFile
return r;
if (p) {
- mkdir_p("/run/systemd/nspawn/locks", 0600);
+ mkdir_p("/run/systemd/nspawn/locks", 0700);
r = make_lock_file(p, operation, global);
if (r < 0) {
@@ -628,7 +628,7 @@ int image_name_lock(const char *name, int operation, LockFile *ret) {
if (streq(name, ".host"))
return -EBUSY;
- mkdir_p("/run/systemd/nspawn/locks", 0600);
+ mkdir_p("/run/systemd/nspawn/locks", 0700);
p = strjoina("/run/systemd/nspawn/locks/name-", name);
return make_lock_file(p, operation, ret);

View File

@ -0,0 +1,116 @@
From 9d311192671afe6d11e8514b4198a70c23f42457 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 9 May 2015 16:20:51 -0500
Subject: [PATCH] man: document forwarding to syslog better
https://bugzilla.redhat.com/show_bug.cgi?id=1147651
(cherry picked from commit 589532d0c61ecd667b0c840ec25faed076f2291e)
---
man/journald.conf.xml | 70 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 44 insertions(+), 26 deletions(-)
diff --git a/man/journald.conf.xml b/man/journald.conf.xml
index 85146b0d82..abfe3130dd 100644
--- a/man/journald.conf.xml
+++ b/man/journald.conf.xml
@@ -97,7 +97,7 @@
needed, so that its existence controls where log data goes.
<literal>none</literal> turns off all storage, all log data
received will be dropped. Forwarding to other targets, such as
- the console, the kernel log buffer or a syslog daemon will
+ the console, the kernel log buffer, or a syslog socket will
still work however. Defaults to
<literal>auto</literal>.</para></listitem>
</varlistentry>
@@ -220,27 +220,19 @@
journald will stop using more space, but it will not be
removing existing files to go reduce footprint either.</para>
- <para><varname>SystemMaxFileSize=</varname>
- and
- <varname>RuntimeMaxFileSize=</varname>
- control how large individual journal
- files may grow at maximum. This
- influences the granularity in which
- disk space is made available through
- rotation, i.e. deletion of historic
- data. Defaults to one eighth of the
- values configured with
+ <para><varname>SystemMaxFileSize=</varname> and
+ <varname>RuntimeMaxFileSize=</varname> control how large
+ individual journal files may grow at maximum. This influences
+ the granularity in which disk space is made available through
+ rotation, i.e. deletion of historic data. Defaults to one
+ eighth of the values configured with
<varname>SystemMaxUse=</varname> and
- <varname>RuntimeMaxUse=</varname>, so
- that usually seven rotated journal
- files are kept as history. Specify
- values in bytes or use K, M, G, T, P,
- E as units for the specified sizes
- (equal to 1024, 1024²,... bytes).
- Note that size limits are enforced
- synchronously when journal files are
- extended, and no explicit rotation
- step triggered by time is
+ <varname>RuntimeMaxUse=</varname>, so that usually seven
+ rotated journal files are kept as history. Specify values in
+ bytes or use K, M, G, T, P, E as units for the specified sizes
+ (equal to 1024, 1024²,... bytes). Note that size limits are
+ enforced synchronously when journal files are extended, and no
+ explicit rotation step triggered by time is
needed.</para></listitem>
</varlistentry>
@@ -308,13 +300,13 @@
daemon, to the kernel log buffer (kmsg), to the system
console, or sent as wall messages to all logged-in users.
These options take boolean arguments. If forwarding to syslog
- is enabled but no syslog daemon is running, the respective
- option has no effect. By default, only forwarding wall is
- enabled. These settings may be overridden at boot time with
- the kernel command line options
+ is enabled but nothing reads messages from the socket,
+ forwarding to syslog has no effect. By default, only
+ forwarding to wall is enabled. These settings may be
+ overridden at boot time with the kernel command line options
<literal>systemd.journald.forward_to_syslog=</literal>,
<literal>systemd.journald.forward_to_kmsg=</literal>,
- <literal>systemd.journald.forward_to_console=</literal> and
+ <literal>systemd.journald.forward_to_console=</literal>, and
<literal>systemd.journald.forward_to_wall=</literal>. When
forwarding to the console, the TTY to log to can be changed
with <varname>TTYPath=</varname>, described
@@ -366,6 +358,32 @@
</refsect1>
<refsect1>
+ <title>Forwarding to traditional syslog daemons</title>
+
+ <para>
+ Journal events can be transfered to a different logging daemon
+ in two different ways. In the first method, messages are
+ immediately forwarded to a socket
+ (<filename>/run/systemd/journal/syslog</filename>), where the
+ traditional syslog daemon can read them. This method is
+ controlled by <varname>ForwardToSyslog=</varname> option. In a
+ second method, a syslog daemon behaves like a normal journal
+ client, and reads messages from the journal files, similarly to
+ <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
+ In this method, messages do not have to be read immediately,
+ which allows a logging daemon which is only started late in boot
+ to access all messages since the start of the system. In
+ addition, full structured meta-data is available to it. This
+ method of course is available only if the messages are stored in
+ a journal file at all. So it will work if
+ <varname>Storage=none</varname> is set. It should be noted that
+ usualy the <emphasis>second</emphasis> method is used by syslog
+ daemons, so the <varname>Storage=</varname> option, and not the
+ <varname>ForwardToSyslog=</varname> option, is relevant for them.
+ </para>
+ </refsect1>
+
+ <refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,

View File

@ -0,0 +1,35 @@
From 34f57ebc813dc576afb3d2f12fa6a26e7978ce3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 9 May 2015 19:46:15 -0400
Subject: [PATCH] man: fix typos in previous comimt
(cherry picked from commit 7703bd4d2874a6becc2be60e284c4a547c28320b)
---
man/journald.conf.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/journald.conf.xml b/man/journald.conf.xml
index abfe3130dd..2cbe58bc15 100644
--- a/man/journald.conf.xml
+++ b/man/journald.conf.xml
@@ -361,7 +361,7 @@
<title>Forwarding to traditional syslog daemons</title>
<para>
- Journal events can be transfered to a different logging daemon
+ Journal events can be transferred to a different logging daemon
in two different ways. In the first method, messages are
immediately forwarded to a socket
(<filename>/run/systemd/journal/syslog</filename>), where the
@@ -375,9 +375,9 @@
to access all messages since the start of the system. In
addition, full structured meta-data is available to it. This
method of course is available only if the messages are stored in
- a journal file at all. So it will work if
+ a journal file at all. So it will not work if
<varname>Storage=none</varname> is set. It should be noted that
- usualy the <emphasis>second</emphasis> method is used by syslog
+ usually the <emphasis>second</emphasis> method is used by syslog
daemons, so the <varname>Storage=</varname> option, and not the
<varname>ForwardToSyslog=</varname> option, is relevant for them.
</para>

View File

@ -0,0 +1,160 @@
From 312596e3f42fd488b652c6234d085c32459e4552 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 2 May 2015 12:01:29 -0500
Subject: [PATCH] generators: rename add_{root,usr}_mount to
add_{sysroot,sysroot_usr}_mount
This makes it obvious that those functions are only usable in the
initramfs.
Also, add a warning when noauto, nofail, or automount is used for the
root fs, instead of silently ignoring. Using those options would be a
sign of significant misconfiguration, and if we bother to check for
them, than let's go all the way and complain.
Other various small cleanups and reformattings elsewhere.
(cherry picked from commit 2e8522767e27d5686206794c69e0aa95da6e798b)
---
src/fstab-generator/fstab-generator.c | 20 ++++++++++++--------
src/shared/generator.c | 21 ++++++++++++---------
src/shared/generator.h | 17 +++++++++++++----
3 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 8e2f522bd0..9fa2d860df 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -192,10 +192,14 @@ static int add_mount(
return 0;
if (path_equal(where, "/")) {
- /* The root disk is not an option */
- automount = false;
- noauto = false;
- nofail = false;
+ if (noauto)
+ log_warning("Ignoring \"noauto\" for root device");
+ if (nofail)
+ log_warning("Ignoring \"nofail\" for root device");
+ if (automount)
+ log_warning("Ignoring automount option for root device");
+
+ noauto = nofail = automount = false;
}
name = unit_name_from_path(where, ".mount");
@@ -394,7 +398,7 @@ static int parse_fstab(bool initrd) {
return r;
}
-static int add_root_mount(void) {
+static int add_sysroot_mount(void) {
_cleanup_free_ char *what = NULL;
const char *opts;
@@ -430,7 +434,7 @@ static int add_root_mount(void) {
"/proc/cmdline");
}
-static int add_usr_mount(void) {
+static int add_sysroot_usr_mount(void) {
_cleanup_free_ char *what = NULL;
const char *opts;
@@ -577,9 +581,9 @@ int main(int argc, char *argv[]) {
/* Always honour root= and usr= in the kernel command line if we are in an initrd */
if (in_initrd()) {
- r = add_root_mount();
+ r = add_sysroot_mount();
if (r == 0)
- r = add_usr_mount();
+ r = add_sysroot_usr_mount();
}
/* Honour /etc/fstab only when that's enabled */
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 7f16d5cbef..cd37812f86 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -33,13 +33,13 @@
int generator_write_fsck_deps(
FILE *f,
- const char *dest,
+ const char *dir,
const char *what,
const char *where,
const char *fstype) {
assert(f);
- assert(dest);
+ assert(dir);
assert(what);
assert(where);
@@ -59,10 +59,10 @@ int generator_write_fsck_deps(
return log_warning_errno(r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype);
}
- if (streq(where, "/")) {
+ if (path_equal(where, "/")) {
char *lnk;
- lnk = strjoina(dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");
+ lnk = strjoina(dir, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");
mkdir_parents(lnk, 0755);
if (symlink(SYSTEM_DATA_UNIT_PATH "/systemd-fsck-root.service", lnk) < 0)
@@ -76,17 +76,20 @@ int generator_write_fsck_deps(
return log_oom();
fprintf(f,
- "RequiresOverridable=%s\n"
- "After=%s\n",
- fsck,
+ "RequiresOverridable=%1$s\n"
+ "After=%1$s\n",
fsck);
}
return 0;
}
-int generator_write_timeouts(const char *dir, const char *what, const char *where,
- const char *opts, char **filtered) {
+int generator_write_timeouts(
+ const char *dir,
+ const char *what,
+ const char *where,
+ const char *opts,
+ char **filtered) {
/* Allow configuration how long we wait for a device that
* backs a mount point to show up. This is useful to support
diff --git a/src/shared/generator.h b/src/shared/generator.h
index 64bd28f596..6c3f38abba 100644
--- a/src/shared/generator.h
+++ b/src/shared/generator.h
@@ -23,7 +23,16 @@
#include <stdio.h>
-int generator_write_fsck_deps(FILE *f, const char *dest, const char *what, const char *where, const char *type);
-
-int generator_write_timeouts(const char *dir, const char *what, const char *where,
- const char *opts, char **filtered);
+int generator_write_fsck_deps(
+ FILE *f,
+ const char *dir,
+ const char *what,
+ const char *where,
+ const char *type);
+
+int generator_write_timeouts(
+ const char *dir,
+ const char *what,
+ const char *where,
+ const char *opts,
+ char **filtered);

View File

@ -0,0 +1,106 @@
From 754ba6bd338a15a698a3152e8fbecbc20d09afec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 6 May 2015 01:09:53 -0400
Subject: [PATCH] Generate systemd-fsck-root.service in the initramfs
In the initrafms, generate a systemd-fsck-root.service to replace
systemd-fsck@<sysroot-device>.service. This way, after we transition
to the real root, systemd-fsck-root.service is marked as already done.
This introduces an unnecessary synchronization point, because
systemd-fsck@* is ordered after systemd-fsck-root also in the
initramfs. In practice this shouldn't be a problem.
https://bugzilla.redhat.com/show_bug.cgi?id=1201979
C.f. 956eaf2b8d6c9999024705ddadc7393bc707de02.
(cherry picked from commit 4dda4e637e4c17a14db6cd265f36f5e8a5050367)
---
src/shared/generator.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 59 insertions(+), 4 deletions(-)
diff --git a/src/shared/generator.c b/src/shared/generator.c
index cd37812f86..148a0b077b 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -29,8 +29,51 @@
#include "generator.h"
#include "path-util.h"
#include "fstab-util.h"
+#include "fileio.h"
#include "dropin.h"
+static int write_fsck_sysroot_service(const char *dir, const char *what) {
+ const char *unit;
+ _cleanup_free_ char *device = NULL;
+ _cleanup_fclose_ FILE *f = NULL;
+
+ unit = strjoina(dir, "/systemd-fsck-root.service");
+ log_debug("Creating %s", unit);
+
+ device = unit_name_from_path(what, ".device");
+ if (!device)
+ return log_oom();
+
+ f = fopen(unit, "wxe");
+ if (!f)
+ return log_error_errno(errno, "Failed to create unit file %s: %m", unit);
+
+ fprintf(f,
+ "# Automatically generated by %1$s\n\n"
+ "[Unit]\n"
+ "Documentation=man:systemd-fsck-root.service(8)\n"
+ "Description=File System Check on %2$s\n"
+ "DefaultDependencies=no\n"
+ "BindsTo=%3$s\n"
+ "After=%3$s\n"
+ "Before=shutdown.target\n"
+ "\n"
+ "[Service]\n"
+ "Type=oneshot\n"
+ "RemainAfterExit=yes\n"
+ "ExecStart=/usr/lib/systemd/systemd-fsck %2$s\n"
+ "TimeoutSec=0\n",
+ program_invocation_short_name,
+ what,
+ device);
+
+ fflush(f);
+ if (ferror(f))
+ return log_error_errno(errno, "Failed to write unit file %s: %m", unit);
+
+ return 0;
+}
+
int generator_write_fsck_deps(
FILE *f,
const char *dir,
@@ -69,11 +112,23 @@ int generator_write_fsck_deps(
return log_error_errno(errno, "Failed to create symlink %s: %m", lnk);
} else {
- _cleanup_free_ char *fsck = NULL;
+ _cleanup_free_ char *_fsck = NULL;
+ const char *fsck;
+ int r;
+
+ if (in_initrd() && path_equal(where, "/sysroot")) {
+ r = write_fsck_sysroot_service(dir, what);
+ if (r < 0)
+ return r;
+
+ fsck = "systemd-fsck-root.service";
+ } else {
+ _fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
+ if (!_fsck)
+ return log_oom();
- fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
- if (!fsck)
- return log_oom();
+ fsck = _fsck;
+ }
fprintf(f,
"RequiresOverridable=%1$s\n"

View File

@ -0,0 +1,30 @@
From 225d44db2d85b493d36bc159945191cc36a3fa21 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 14 May 2015 22:32:35 +0200
Subject: [PATCH] units: fix typo in systemd-resolved.service
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There's no network.service unit, we actually mean network.target here.
Reported by Fco. Eduardo Ramírez.
(cherry picked from commit 1dff3202941786dd00060f078f6b031efe52d3c3)
---
units/systemd-resolved.service.m4.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-resolved.service.m4.in b/units/systemd-resolved.service.m4.in
index d133847d5e..98ae564af6 100644
--- a/units/systemd-resolved.service.m4.in
+++ b/units/systemd-resolved.service.m4.in
@@ -8,7 +8,7 @@
[Unit]
Description=Network Name Resolution
Documentation=man:systemd-resolved.service(8)
-After=systemd-networkd.service network.service
+After=systemd-networkd.service network.target
m4_ifdef(`ENABLE_KDBUS',
# On kdbus systems we pull in the busname explicitly, because it

View File

@ -0,0 +1,25 @@
From 426edae354b8ac159eedbf01d7d8b3933c3b96ca Mon Sep 17 00:00:00 2001
From: Davide Bettio <davide.bettio@ispirata.com>
Date: Fri, 15 May 2015 16:36:28 +0200
Subject: [PATCH] core: don't consider umask for SocketMode=
https://bugs.freedesktop.org/show_bug.cgi?id=89248
(cherry picked from commit a2c7f25aec23b6d74ff5cf169e38159754e6dfe8)
---
src/shared/socket-label.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/shared/socket-label.c b/src/shared/socket-label.c
index 6806c51158..a6289eb50f 100644
--- a/src/shared/socket-label.c
+++ b/src/shared/socket-label.c
@@ -117,9 +117,6 @@ int socket_address_listen(
/* Enforce the right access mode for the socket */
old_mask = umask(~ socket_mode);
- /* Include the original umask in our mask */
- umask(~socket_mode | old_mask);
-
r = mac_selinux_bind(fd, &a->sockaddr.sa, a->size);
if (r < 0 && errno == EADDRINUSE) {

View File

@ -0,0 +1,68 @@
From 41c7bce9cde89f981b7e82e5a0d5e49e321088fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
Date: Fri, 15 May 2015 13:26:18 -0300
Subject: [PATCH] timedate: fix memory leak in timedated
$ /usr/lib/systemd/systemd-timedated (wait until auto-exit)
=================================================================
==396==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 928 byte(s) in 1 object(s) allocated from:
#0 0x7f782f788db1 in __interceptor_calloc (/usr/lib64/libasan.so.2+0x96db1)
#1 0x562a83ae60cf in bus_message_from_header src/libsystemd/sd-bus/bus-message.c:480
#2 0x562a83ae6f5a in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:576
#3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
#4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
#5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
#6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
#7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
#8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
#9 0x562a83aae1af in main src/timedate/timedated.c:730
#10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)
Indirect leak of 77 byte(s) in 1 object(s) allocated from:
#0 0x7f782f788f6a in realloc (/usr/lib64/libasan.so.2+0x96f6a)
#1 0x562a83ad418a in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:963
#2 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
#3 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
#4 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
#5 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
#6 0x562a83aae1af in main src/timedate/timedated.c:730
#7 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)
Indirect leak of 2 byte(s) in 1 object(s) allocated from:
#0 0x7f782f75493f in strdup (/usr/lib64/libasan.so.2+0x6293f)
#1 0x562a83b0229b in bus_message_parse_fields src/libsystemd/sd-bus/bus-message.c:5382
#2 0x562a83ae7290 in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:601
#3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
#4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
#5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
#6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
#7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
#8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
#9 0x562a83aae1af in main src/timedate/timedated.c:730
#10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)
SUMMARY: AddressSanitizer: 1007 byte(s) leaked in 3 allocation(s).
This is due to missing _cleanup_bus_message_unref_ in context_read_ntp()
(cherry picked from commit 6b71bab08dc6c92156263daba0e969313eed1323)
---
src/timedate/timedated.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index f2d23f34b1..5ea6e654dc 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -188,7 +188,7 @@ static int context_write_data_local_rtc(Context *c) {
static int context_read_ntp(Context *c, sd_bus *bus) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- sd_bus_message *reply = NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
const char *s;
int r;

View File

@ -0,0 +1,76 @@
From f7981f669621f3873c2182cac08a39086acf3a84 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Thu, 14 May 2015 09:06:40 +0200
Subject: [PATCH] core: Fix assertion with empty Exec*= paths
An Exec*= line with whitespace after modifiers, like
ExecStart=- /bin/true
is considered to have an empty command path. This is as specified, but causes
systemd to crash with
Assertion 'skip < l' failed at ../src/core/load-fragment.c:607, function config_parse_exec(). Aborting.
Aborted (core dumped)
Fix this by logging an error instead and ignoring the invalid line.
Add corresponding test cases. Also add a test case for a completely empty value
which resets the command list.
https://launchpad.net/bugs/1454173
(cherry picked from commit 35b1078e1c375df244e19961792aeb78ca34bb54)
---
src/core/load-fragment.c | 6 +++++-
src/test/test-unit-file.c | 21 +++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index f17a82fcdf..ec4cf4eefa 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -604,7 +604,11 @@ int config_parse_exec(const char *unit,
skip = separate_argv0 + ignore;
/* skip special chars in the beginning */
- assert(skip < l);
+ if (l <= skip) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Empty path in command line, ignoring: %s", rvalue);
+ r = 0;
+ goto fail;
+ }
} else if (strneq(word, ";", MAX(l, 1U)))
/* new commandline */
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index 9f3e3a227e..5500983322 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -318,6 +318,27 @@ static void test_config_parse_exec(void) {
assert_se(r == 0);
assert_se(c1->command_next == NULL);
+ log_info("/* invalid space between modifiers */");
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, "- /path",
+ &c, NULL);
+ assert_se(r == 0);
+ assert_se(c1->command_next == NULL);
+
+ log_info("/* only modifiers, no path */");
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, "-",
+ &c, NULL);
+ assert_se(r == 0);
+ assert_se(c1->command_next == NULL);
+
+ log_info("/* empty argument, reset */");
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, "",
+ &c, NULL);
+ assert_se(r == 0);
+ assert_se(c == NULL);
+
exec_command_free_list(c);
}

View File

@ -0,0 +1,54 @@
From 705313fc28f30ba3535d190ecb7ded21f66cc870 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 15 May 2015 20:56:55 +0200
Subject: [PATCH] coredump: make sure we vacuum by default
Only if both keep_free and max_use are actually 0 we can shortcut things
and avoid vacuuming. If either are positive or -1 we need to execute the
vacuuming.
http://lists.freedesktop.org/archives/systemd-devel/2015-April/031382.html
(cherry picked from commit 5470c03b37d8421a903564c2c8028c8b8d67d403)
---
man/coredump.conf.xml | 4 +++-
src/journal/coredump-vacuum.c | 5 ++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/man/coredump.conf.xml b/man/coredump.conf.xml
index 0b7329bf55..fd54c59e6b 100644
--- a/man/coredump.conf.xml
+++ b/man/coredump.conf.xml
@@ -134,7 +134,9 @@
by coredumps might temporarily exceed these limits while
coredumps are processed. Note that old coredumps are also
removed based on time via
- <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para></listitem>
+ <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>. Set
+ either value to 0 to turn off size based
+ clean-up.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/src/journal/coredump-vacuum.c b/src/journal/coredump-vacuum.c
index 9b73795e5b..c0347ef569 100644
--- a/src/journal/coredump-vacuum.c
+++ b/src/journal/coredump-vacuum.c
@@ -103,8 +103,7 @@ static bool vacuum_necessary(int fd, off_t sum, off_t keep_free, off_t max_use)
if (max_use < DEFAULT_MAX_USE_LOWER)
max_use = DEFAULT_MAX_USE_LOWER;
- }
- else
+ } else
max_use = DEFAULT_MAX_USE_LOWER;
} else
max_use = PAGE_ALIGN(max_use);
@@ -135,7 +134,7 @@ int coredump_vacuum(int exclude_fd, off_t keep_free, off_t max_use) {
struct stat exclude_st;
int r;
- if (keep_free <= 0 && max_use <= 0)
+ if (keep_free == 0 && max_use == 0)
return 0;
if (exclude_fd >= 0) {

View File

@ -0,0 +1,48 @@
From b505f6560ea203ff1440da4d2b653b839e621aba Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 15 May 2015 21:47:22 +0200
Subject: [PATCH] tmpfiles: don't fail if we cannot create a subvolume because
a file system is read-only but a dir already exists anyway
https://bugs.freedesktop.org/show_bug.cgi?id=90281
(cherry picked from commit 7b135a73999b6911ebb85c053b6f7701fdac1883)
---
src/tmpfiles/tmpfiles.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 73a9c9d5b6..d0e6567d8a 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1002,20 +1002,25 @@ static int create_item(Item *i) {
r = mkdir_label(i->path, i->mode);
if (r < 0) {
- if (r != -EEXIST)
- return log_error_errno(r, "Failed to create directory or subvolume \"%s\": %m", i->path);
+ int k;
- if (stat(i->path, &st) < 0)
- return log_error_errno(errno, "stat(%s) failed: %m", i->path);
+ if (r != -EEXIST && r != -EROFS)
+ return log_error_errno(r, "Failed to create directory or subvolume \"%s\": %m", i->path);
- if (!S_ISDIR(st.st_mode)) {
- log_debug("\"%s\" already exists and is not a directory.", i->path);
+ k = is_dir(i->path, false);
+ if (k == -ENOENT && r == -EROFS)
+ return log_error_errno(r, "%s does not exist and cannot be created as the file system is read-only.", i->path);
+ if (k < 0)
+ return log_error_errno(k, "Failed to check if %s exists: %m", i->path);
+ if (!k) {
+ log_warning("\"%s\" already exists and is not a directory.", i->path);
return 0;
}
creation = CREATION_EXISTING;
} else
creation = CREATION_NORMAL;
+
log_debug("%s directory \"%s\".", creation_mode_verb_to_string(creation), i->path);
r = path_set_perms(i, i->path);

View File

@ -0,0 +1,130 @@
From 9ca241de9a5c772044540e46366236a5fc8510b5 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Wed, 22 Apr 2015 15:52:59 -0700
Subject: [PATCH] zsh-completion: add missing completions for machinectl
Appologies, I'm still getting used to this mailing list thing and using git send-email
(cherry picked from commit b3b9282d0c79b108ed87abff5de6891617fe0602)
---
shell-completion/zsh/_machinectl | 84 +++++++++++++++++++++++++++++++++-------
1 file changed, 70 insertions(+), 14 deletions(-)
diff --git a/shell-completion/zsh/_machinectl b/shell-completion/zsh/_machinectl
index c666b7eb43..7898d7c05b 100644
--- a/shell-completion/zsh/_machinectl
+++ b/shell-completion/zsh/_machinectl
@@ -1,5 +1,20 @@
#compdef machinectl
+__get_available_machines () {
+ machinectl --no-legend list-images | {while read -r a b; do echo $a; done;}
+}
+
+_available_machines() {
+ local -a _machines
+ _machines=("${(fo)$(__get_available_machines)}")
+ typeset -U _machines
+ if [[ -n "$_machines" ]]; then
+ _describe 'machines' _machines
+ else
+ _message 'no machines'
+ fi
+}
+
(( $+functions[_machinectl_command] )) || _machinectl_command()
{
local -a _machinectl_cmds
@@ -7,23 +22,55 @@
"list:List currently running VMs/containers"
"status:Show VM/container status"
"show:Show properties of one or more VMs/containers"
+ "start:Start container as a service"
"login:Get a login prompt on a VM/container"
+ "enable:Enable automatic container start at boot"
+ "disable:Disable automatic container start at boot"
"poweroff:Power off one or more VMs/containers"
"reboot:Reboot one or more VMs/containers"
"terminate:Terminate one or more VMs/containers"
"kill:Send signal to process or a VM/container"
+ "copy-to:Copy files from the host to a container"
+ "copy-from:Copy files from a container to the host"
+ "bind:Bind mount a path from the host into a container"
+
+ "list-images:Show available container and VM images"
+ "image-status:Show image details"
+ "show-image:Show properties of image"
+ "clone:Clone an image"
+ "rename:Rename an image"
+ "read-only:Mark or unmark image read-only"
+ "remove:Remove an image"
+
+ "pull-tar:Download a TAR container image"
+ "pull-raw:Download a RAW container or VM image"
+ "pull-dkr:Download a DKR container image"
+ "list-transfers:Show list of downloads in progress"
+ "cancel-transfer:Cancel a download"
)
+
if (( CURRENT == 1 )); then
_describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@"
else
local curcontext="$curcontext"
cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}"
if (( $#cmd )); then
- case $cmd in
- list) msg="no options" ;;
- *)
- _sd_machines
- esac
+ if (( CURRENT == 2 )); then
+ case $cmd in
+ list*|cancel-transfer|pull-tar|pull-raw|pull-dkr)
+ msg="no options" ;;
+ start)
+ _available_machines ;;
+ *)
+ _sd_machines
+ esac
+ else
+ case $cmd in
+ copy-to|copy-from|bind)
+ _files ;;
+ *) msg="no options"
+ esac
+ fi
else
_message "no more options"
fi
@@ -33,13 +80,22 @@
_arguments \
{-h,--help}'[Prints a short help text and exits.]' \
'--version[Prints a short version string and exits.]' \
- \*{-p+,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
- {-a,--all}'[Show all proerties]' \
- (-l,--full)'[Do not ellipsize cgroup members]' \
- '--no-pager[Do not pipe output into a pager]' \
- '--no-ask-password[Do not ask for system passwords]' \
- '--kill-who=[Who to send signal to]:killwho:(leader all)' \
- {-s+,--signal=}'[Which signal to send]:signal:_signals' \
- {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
- {-P,--privileged}'[Acquire privileges before execution]' \
+ '--no-pager[Do not pipe output into a pager.]' \
+ '--no-legend[Do not show the headers and footers.]' \
+ '--no-ask-password[Do not ask for system passwords.]' \
+ {-H+,--host=}'[Operate on remote host.]:userathost:_sd_hosts_or_user_at_host' \
+ {-M+,--machine=}'[Operate on local container.]:machine:_sd_machines' \
+ {-p+,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
+ {-a,--all}'[Show all proerties.]' \
+ {-q,--quiet}'[Suppress output.]' \
+ {-l,--full}'[Do not ellipsize cgroup members.]' \
+ '--kill-who=[Who to send signal to.]:killwho:(leader all)' \
+ {-s+,--signal=}'[Which signal to send.]:signal:_signals' \
+ '--read-only[Create read-only bind mount.]' \
+ '--mkdir[Create directory before bind mounting, if missing.]' \
+ {-n+,--lines=}'[Number of journal entries to show.]:integer' \
+ {-o+,--output=}'[Change journal output mode.]:output modes:_sd_outputmodes' \
+ '--verify=[Verification mode for downloaded images.]:verify:(no checksum signature)' \
+ '--force[Download image even if already exists.]' \
+ '--dkr-index-url=[Specify the index URL to use for DKR image downloads.]' \
'*::machinectl command:_machinectl_command'

View File

@ -0,0 +1,21 @@
From 1b31568fa9d3453ec4b880f846816daf7f94a445 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Wed, 22 Apr 2015 11:07:38 -0700
Subject: [PATCH] zsh-completion: update -M completion for systemd-analyze
(cherry picked from commit b93f15cd056ca71b7e0aa0560992da345e87f974)
---
shell-completion/zsh/_systemd-analyze | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shell-completion/zsh/_systemd-analyze b/shell-completion/zsh/_systemd-analyze
index 2c0e5433eb..efafddc686 100644
--- a/shell-completion/zsh/_systemd-analyze
+++ b/shell-completion/zsh/_systemd-analyze
@@ -54,5 +54,5 @@ _arguments \
'--from-pattern=[When generating a dependency graph, filter only origins]:GLOB' \
'--to-pattern=[When generating a dependency graph, filter only destinations]:GLOB' \
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
- {-M+,--machine=}'[Operate on local container]:machine' \
+ {-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \
'*::systemd-analyze commands:_systemd_analyze_command'

View File

@ -0,0 +1,62 @@
From b632845742c568b5576fdae430983deb42c7897a Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Wed, 22 Apr 2015 11:07:39 -0700
Subject: [PATCH] zsh-completion: add missing completions for systemd-nspawn
(cherry picked from commit 6b85708cfd371f40ed95462cd8787ee0673ad36d)
---
shell-completion/zsh/_systemd-nspawn | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/shell-completion/zsh/_systemd-nspawn b/shell-completion/zsh/_systemd-nspawn
index ceedb2c5a0..08f5696acb 100644
--- a/shell-completion/zsh/_systemd-nspawn
+++ b/shell-completion/zsh/_systemd-nspawn
@@ -11,34 +11,38 @@ _nspawn-caps(){
}
_arguments \
- {-h,--help}'[Show this help]' \
+ {-h,--help}'[Show this help.]' \
+ '--version[Print a short version string and exit.]' \
+ {--quiet,-q}'[Turns off any status output by the tool itself.]' \
{--directory=,-D+}'[Directory to use as file system root for the namespace container. If omitted the current directory will be used.]:directories:_directories' \
+ '--template=[Initialize root directory from template directory, if missing.]:template:_directories' \
+ {--ephemeral,-x}'[Run container with snapshot of root directory, and remove it after exit.]' \
{--image=,-i+}'[Disk image to mount the root directory for the container from.]' \
{--boot=,-b+}'[Automatically search for an init binary and invoke it instead of a shell or a user supplied program.]' \
{--user=,-u+}'[Run the command under specified user, create home directory and cd into it.]' \
{--machine=,-M+}'[Sets the machine name for this container.]' \
'--uuid=[Set the specified uuid for the container.]' \
- '--slice=[Make the container part of the specified slice, instead of the default machine.slice.]' \
- '--private-network[Turn off networking in the container. This makes all network interfaces unavailable in the container, with the exception of the loopback device.]' \
+ {--slice=,-S+}'[Make the container part of the specified slice, instead of the default machine.slice.]' \
'--private-network[Disconnect networking of the container from the host.]' \
'--network-interface=[Assign the specified network interface to the container.]' \
'--network-macvlan=[Create a "macvlan" interface of the specified Ethernet network interface and add it to the container.]' \
- '--network-veth[Create a virtual Ethernet link (veth) between host and container.]' \
+ '--network-ipvlan=[Create a ipvlan network interface based on an existing network interface to the container.]' \
+ {--network-veth,-n}'[Create a virtual Ethernet link (veth) between host and container.]' \
'--network-bridge=[Adds the host side of the Ethernet link created with --network-veth to the specified bridge.]' \
+ {--port=,-p+}'[Expose a container IP port on the host.]' \
{--selinux-context=,-Z+}'[Sets the SELinux security context to be used to label processes in the container.]' \
{--selinux-apifs-context=,-L+}'[Sets the SELinux security context to be used to label files in the virtual API file systems in the container.]' \
'--capability=[List one or more additional capabilities to grant the container.]:capabilities:_nspawn-caps' \
- '--drop-capability=[Specify one or more additional capabilities to drop for the container]' \
- "--link-journal=[Control whether the container's journal shall be made visible to the host system.]:options:(no, host, guest, auto)" \
+ '--drop-capability=[Specify one or more additional capabilities to drop for the containerm]:capabilities:_nspawn-caps' \
+ "--link-journal=[Control whether the container's journal shall be made visible to the host system.]:options:(no host guest auto)" \
'-j[Equivalent to --link-journal=guest.]' \
'--read-only[Mount the root file system read only for the container.]' \
'--bind=[Bind mount a file or directory from the host into the container.]' \
'--bind-ro=[Bind mount a file or directory from the host into the container (read-only).]' \
+ '--tmpfs=[Mount an empty tmpfs to the specified directory.]' \
'--setenv=[Specifies an environment variable assignment to pass to the init process in the container, in the format "NAME=VALUE".]' \
'--share-system[Allows the container to share certain system facilities with the host.]' \
'--register=[Controls whether the container is registered with systemd-machined(8).]' \
'--keep-unit[Instead of creating a transient scope unit to run the container in, simply register the service or scope unit systemd-nspawn has been invoked in with systemd-machined(8).]' \
'--personality=[Control the architecture ("personality") reported by uname(2) in the container.]' \
- {--quiet,-q}'[Turns off any status output by the tool itself.]' \
- {--help,-h}'[Print a short help text and exit.]' \
- '--version[Print a short version string and exit.]'
+ '--volatile=[Run the system in volatile mode.]:volatile:(no yes state)'

View File

@ -0,0 +1,48 @@
From 21427b3c9865a0a7871d47e55b041d371dcfe36f Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Mon, 18 May 2015 01:02:38 -0400
Subject: [PATCH] zsh-completion: actually run _filter_units_by_property when
creating the arrays _sys_(re|)startable_units
(cherry picked from commit 67afa93148ca51eb1d37717ad3c3cac980be1c7a)
---
shell-completion/zsh/_systemctl.in | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index 82edfd3d74..d2024b3cce 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -149,20 +149,20 @@ _systemctl_get_template_names() { __systemctl list-unit-files | { while read -r
_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )}
_systemctl_startable_units(){
- _sys_startable_units=(_filter_units_by_property ActiveState inactive $(
+ _sys_startable_units=( $( _filter_units_by_property ActiveState inactive $(
_filter_units_by_property CanStart yes $(
__systemctl $mode list-unit-files --state enabled,disabled,static | \
{ while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; }
__systemctl $mode list-units --state inactive,failed | \
- { while read -r a b; do echo -E - " $a"; done; } )))
+ { while read -r a b; do echo -E - " $a"; done; } )) ) )
}
_systemctl_restartable_units(){
- _sys_restartable_units=(_filter_units_by_property CanStart yes $(
+ _sys_restartable_units=( $(_filter_units_by_property CanStart yes $(
__systemctl $mode list-unit-files --state enabled,disabled,static | \
{ while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; }
__systemctl $mode list-units | \
- { while read -r a b; do echo -E - " $a"; done; } ))
+ { while read -r a b; do echo -E - " $a"; done; } )) )
}
_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )}
@@ -170,6 +170,7 @@ _systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files
_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read -r a b; do [[ $b == "disabled" ]] && echo -E - " $a"; done; }) )}
_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "masked" ]] && echo -E - " $a"; done; }) )}
+local fun
# Completion functions for ALL_UNITS
for fun in is-active is-failed is-enabled status show cat mask preset help list-dependencies edit ; do
(( $+functions[_systemctl_$fun] )) || _systemctl_$fun()

View File

@ -0,0 +1,73 @@
From 5fcc4e9b7958db15317bd7ca523d4fdb19049128 Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Mon, 18 May 2015 01:02:39 -0400
Subject: [PATCH] zsh-completion: actually complete template names for
subcommands enable, reenable and disable.
compadd's -a option treats non-option arguments as arrays. So
$(_systemctl_get_template_names) expands to some words that aren't
legal array names. Even if there were, they would be empty; thus adding
nothing.
deduplicated a few functions too.
(cherry picked from commit fb869ca1d20e503708ae813c3d3ebcf5a5173c25)
---
shell-completion/zsh/_systemctl.in | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index d2024b3cce..427572355a 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -166,9 +166,7 @@ _systemctl_restartable_units(){
}
_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )}
-_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "enabled" ]] && echo -E - " $a"; done; }) )}
-_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read -r a b; do [[ $b == "disabled" ]] && echo -E - " $a"; done; }) )}
-_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "masked" ]] && echo -E - " $a"; done; }) )}
+_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files) ) }
local fun
# Completion functions for ALL_UNITS
@@ -183,22 +181,21 @@ done
# Completion functions for ENABLED_UNITS
(( $+functions[_systemctl_disable] )) || _systemctl_disable()
{
- _systemctl_enabled_units
- compadd "$@" -a - _sys_enabled_units
+ local _sys_unit_state; _systemctl_unit_state
+ compadd "$@" - ${(k)_sys_unit_state[(R)enabled]}
}
(( $+functions[_systemctl_reenable] )) || _systemctl_reenable()
{
- _systemctl_enabled_units
- _systemctl_disabled_units
- compadd "$@" -a - _sys_enabled_units _sys_disabled_units $(_systemctl_get_template_names)
+ local _sys_unit_state; _systemctl_unit_state
+ compadd "$@" - ${(k)_sys_unit_state[(R)(enabled|disabled)]} $(_systemctl_get_template_names)
}
# Completion functions for DISABLED_UNITS
(( $+functions[_systemctl_enable] )) || _systemctl_enable()
{
- _systemctl_disabled_units
- compadd "$@" -a - _sys_disabled_units $(_systemctl_get_template_names)
+ local _sys_unit_state; _systemctl_unit_state
+ compadd "$@" - ${(k)_sys_unit_state[(R)disabled]} $(_systemctl_get_template_names)
}
# Completion functions for FAILED_UNITS
@@ -255,8 +252,8 @@ done
# Completion functions for MASKED_UNITS
(( $+functions[_systemctl_unmask] )) || _systemctl_unmask()
{
- _systemctl_masked_units
- compadd "$@" -a - _sys_masked_units || _message "no masked units found"
+ local _sys_unit_state; _systemctl_unit_state
+ compadd "$@" - ${(k)_sys_unit_state[(R)masked]} || _message "no masked units found"
}
# Completion functions for JOBS

View File

@ -0,0 +1,24 @@
From 5ee6d932fe185b8ae007bb47b34026308ac33623 Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Mon, 18 May 2015 01:02:40 -0400
Subject: [PATCH] zsh-completion: less forking in
_systemctl_get_template_names()
(cherry picked from commit e4e868f3aeedccfe04c6b6c3be026c7f8873370a)
---
shell-completion/zsh/_systemctl.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index 427572355a..b8921791dd 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -143,7 +143,7 @@ _filter_units_by_property() {
done
}
-_systemctl_get_template_names() { __systemctl list-unit-files | { while read -r a b; do [[ $a =~ @\. ]] && echo -E - " ${a%%@.*}@"; done; } }
+_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files)"}##*@.[^[:space:]]##}%%@.*}\@ }
_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )}

View File

@ -0,0 +1,33 @@
From 8d660f18b2b967f43b5891958553f0319d4f9f02 Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Mon, 18 May 2015 01:02:41 -0400
Subject: [PATCH] zsh-completion: less forking in _systemctl_failed_units() and
make the array `_sys_failed_units' local to the completer.
(cherry picked from commit 463985a9f489c54b89ee7ce6ffd67501035420b4)
---
shell-completion/zsh/_systemctl.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index b8921791dd..e95b7d3af0 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -165,7 +165,7 @@ _systemctl_restartable_units(){
{ while read -r a b; do echo -E - " $a"; done; } )) )
}
-_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )}
+_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --failed)"}%% *} ) }
_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files) ) }
local fun
@@ -201,7 +201,7 @@ done
# Completion functions for FAILED_UNITS
(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
{
- _systemctl_failed_units
+ local _sys_failed_units; _systemctl_failed_units
compadd "$@" -a - _sys_failed_units || _message "no failed unit found"
}

View File

@ -0,0 +1,105 @@
From cd2c48a58a8cdbaab89c0227355a47ef27a5be53 Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Mon, 18 May 2015 03:19:59 -0400
Subject: [PATCH] zsh-completion: removing more pointless forks
I seem to have forgot about _systemctl_active_units().
(cherry picked from commit 2103d29d89f32546f95b9ec019be0ea06714c8c2)
---
shell-completion/zsh/_systemctl.in | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index e95b7d3af0..2a3e21bf17 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -105,7 +105,7 @@ _systemctl_all_units()
if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
! _retrieve_cache SYS_ALL_UNITS;
then
- _sys_all_units=( $(__systemctl list-units --all | { while read -r a b; do echo -E - " $a"; done; }) )
+ _sys_all_units=( ${${(f)"$(__systemctl list-units --all)"}%% *} )
_store_cache SYS_ALL_UNITS _sys_all_units
fi
}
@@ -118,7 +118,7 @@ _systemctl_really_all_units()
if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) &&
! _retrieve_cache SYS_REALLY_ALL_UNITS;
then
- all_unit_files=( $(__systemctl list-unit-files | { while read -r a b; do echo -E - " $a"; done; }) )
+ all_unit_files=( ${${(f)"$(__systemctl list-unit-files)"}%% *} )
_systemctl_all_units
really_all_units=($_sys_all_units $all_unit_files)
_sys_really_all_units=(${(u)really_all_units})
@@ -146,7 +146,7 @@ _filter_units_by_property() {
_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files)"}##*@.[^[:space:]]##}%%@.*}\@ }
-_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )}
+_systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units)"}%% *} )}
_systemctl_startable_units(){
_sys_startable_units=( $( _filter_units_by_property ActiveState inactive $(
@@ -259,22 +259,22 @@ done
# Completion functions for JOBS
(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
{
- compadd "$@" - $(__systemctl list-jobs \
- | cut -d' ' -f1 2>/dev/null ) || _message "no jobs found"
+ compadd "$@" - ${${(f)"$(__systemctl list-jobs)"}%% *} ||
+ _message "no jobs found"
}
# Completion functions for SNAPSHOTS
(( $+functions[_systemctl_delete] )) || _systemctl_delete()
{
- compadd "$@" - $(__systemctl list-units --type snapshot --all \
- | cut -d' ' -f1 2>/dev/null ) || _message "no snapshots found"
+ compadd "$@" - ${${(f)"$(__systemctl list-units --type snapshot --all)"}%% *} ||
+ _message "no snapshots found"
}
# Completion functions for TARGETS
(( $+functions[_systemctl_set-default] )) || _systemctl_set-default()
{
- compadd "$@" - $(__systemctl list-unit-files --type target --all \
- | cut -d' ' -f1 2>/dev/null ) || _message "no targets found"
+ compadd "$@" - ${${(f)"$(__systemctl list-unit-files --type target --all)"}%% *} ||
+ _message "no targets found"
}
# Completion functions for ENVS
@@ -287,8 +287,7 @@ for fun in set-environment unset-environment ; do
suf='-S='
fi
- compadd "$@" ${suf} - $(systemctl show-environment \
- | while read line; do echo " ${line%%\=}";done )
+ compadd "$@" ${suf} - ${${(f)"$(systemctl show-environment)"}%%=*}
}
done
@@ -315,7 +314,7 @@ _systemctl_caching_policy()
oldcache=( "$1"(mh+1) )
(( $#oldcache )) && return 0
- _sysunits=($(__systemctl --all | cut -d' ' -f1))
+ _sysunits=(${${(f)"$(__systemctl --all)"}%% *})
if (( $#_sysunits )); then
for unit in $_sysunits; do
@@ -342,10 +341,9 @@ _unit_properties() {
if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES ) &&
! _retrieve_cache SYS_ALL_PROPERTIES;
then
- _sys_all_properties=( $( {__systemctl show --all;
- @rootlibexecdir@/systemd --dump-configuration-items; } | {
- while IFS='=' read -r a b; do [ -n "$b" ] && echo "$a"; done
- }) )
+ _sys_all_properties=( ${${(M)${(f)"$(__systemctl show --all;
+ @rootlibexecdir@/systemd --dump-configuration-items)"}##[[:alnum:]]##=*}%%=*}
+ )
_store_cache SYS_ALL_PROPRTIES _sys_all_properties
fi
_values -s , "${_sys_all_properties[@]}"

View File

@ -0,0 +1,51 @@
From 29ead1919564e18dc7a3aee2214543db02aea72d Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Mon, 18 May 2015 01:02:43 -0400
Subject: [PATCH] zsh-completion: make the arrays _sys_active_units,
_sys_startable_units and _sys_restartable_units local to the completer.
(cherry picked from commit bf8864c2c07f3bdab4ab4287bf2b5d3b5ce21f5c)
---
shell-completion/zsh/_systemctl.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index 2a3e21bf17..673b976e34 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -208,7 +208,7 @@ done
# Completion functions for STARTABLE_UNITS
(( $+functions[_systemctl_start] )) || _systemctl_start()
{
- _systemctl_startable_units
+ local _sys_startable_units; _systemctl_startable_units
compadd "$@" - ${_sys_startable_units[*]} $(_systemctl_get_template_names)
}
@@ -216,7 +216,7 @@ done
for fun in stop kill try-restart condrestart ; do
(( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
{
- _systemctl_active_units
+ local _sys_active_units; _systemctl_active_units
compadd "$@" - $( _filter_units_by_property CanStop yes \
${_sys_active_units[*]} )
}
@@ -234,7 +234,7 @@ done
for fun in reload reload-or-try-restart force-reload ; do
(( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
{
- _systemctl_active_units
+ local _sys_active_units; _systemctl_active_units
compadd "$@" - $( _filter_units_by_property CanReload yes \
${_sys_active_units[*]} )
}
@@ -244,7 +244,7 @@ done
for fun in restart reload-or-restart ; do
(( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
{
- _systemctl_restartable_units
+ local _sys_restartable_units; _systemctl_restartable_units
compadd "$@" - ${_sys_restartable_units[*]} $(_systemctl_get_template_names)
}
done

View File

@ -0,0 +1,148 @@
From 8851f051210fa9c18ffb94ebe601261bacaf37d4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 18 May 2015 23:23:17 +0200
Subject: [PATCH] resolved: fix crash when shutting down
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reported by Cristian Rodríguez
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html
(cherry picked from commit cab5b05903096e1c9cf5575ccc73f89d15c8db69)
---
src/resolve/resolved-dns-cache.c | 7 ++-----
src/resolve/resolved-dns-server.c | 15 ++++++++-------
src/resolve/resolved-link.c | 6 +++---
src/resolve/resolved-manager.c | 4 ++--
src/shared/prioq.c | 6 ++++--
src/shared/prioq.h | 2 +-
6 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index 33ca4d1a45..be52891681 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -91,11 +91,8 @@ void dns_cache_flush(DnsCache *c) {
assert(hashmap_size(c->by_key) == 0);
assert(prioq_size(c->by_expiry) == 0);
- hashmap_free(c->by_key);
- c->by_key = NULL;
-
- prioq_free(c->by_expiry);
- c->by_expiry = NULL;
+ c->by_key = hashmap_free(c->by_key);
+ c->by_expiry = prioq_free(c->by_expiry);
}
static void dns_cache_remove(DnsCache *c, DnsResourceKey *key) {
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c
index caf06fe450..9a62a63258 100644
--- a/src/resolve/resolved-dns-server.c
+++ b/src/resolve/resolved-dns-server.c
@@ -78,23 +78,24 @@ DnsServer* dns_server_free(DnsServer *s) {
if (!s)
return NULL;
- if (s->manager) {
+ if (s->link) {
if (s->type == DNS_SERVER_LINK)
LIST_REMOVE(servers, s->link->dns_servers, s);
- else if (s->type == DNS_SERVER_SYSTEM)
+
+ if (s->link->current_dns_server == s)
+ link_set_dns_server(s->link, NULL);
+ }
+
+ if (s->manager) {
+ if (s->type == DNS_SERVER_SYSTEM)
LIST_REMOVE(servers, s->manager->dns_servers, s);
else if (s->type == DNS_SERVER_FALLBACK)
LIST_REMOVE(servers, s->manager->fallback_dns_servers, s);
- else
- assert_not_reached("Unknown server type");
if (s->manager->current_dns_server == s)
manager_set_dns_server(s->manager, NULL);
}
- if (s->link && s->link->current_dns_server == s)
- link_set_dns_server(s->link, NULL);
-
free(s);
return NULL;
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index f94e4bb6f0..27d9129e00 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -68,13 +68,13 @@ Link *link_free(Link *l) {
if (l->manager)
hashmap_remove(l->manager->links, INT_TO_PTR(l->ifindex));
+ while (l->dns_servers)
+ dns_server_free(l->dns_servers);
+
dns_scope_free(l->unicast_scope);
dns_scope_free(l->llmnr_ipv4_scope);
dns_scope_free(l->llmnr_ipv6_scope);
- while (l->dns_servers)
- dns_server_free(l->dns_servers);
-
free(l);
return NULL;
}
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index b5ad701611..7c253aa13f 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -536,11 +536,11 @@ Manager *manager_free(Manager *m) {
while (m->dns_queries)
dns_query_free(m->dns_queries);
- dns_scope_free(m->unicast_scope);
-
manager_flush_dns_servers(m, DNS_SERVER_SYSTEM);
manager_flush_dns_servers(m, DNS_SERVER_FALLBACK);
+ dns_scope_free(m->unicast_scope);
+
hashmap_free(m->links);
hashmap_free(m->dns_transactions);
diff --git a/src/shared/prioq.c b/src/shared/prioq.c
index 8af4c51c2f..b89888be0e 100644
--- a/src/shared/prioq.c
+++ b/src/shared/prioq.c
@@ -45,12 +45,14 @@ Prioq *prioq_new(compare_func_t compare_func) {
return q;
}
-void prioq_free(Prioq *q) {
+Prioq* prioq_free(Prioq *q) {
if (!q)
- return;
+ return NULL;
free(q->items);
free(q);
+
+ return NULL;
}
int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func) {
diff --git a/src/shared/prioq.h b/src/shared/prioq.h
index d836b36cd9..1c044b135c 100644
--- a/src/shared/prioq.h
+++ b/src/shared/prioq.h
@@ -28,7 +28,7 @@ typedef struct Prioq Prioq;
#define PRIOQ_IDX_NULL ((unsigned) -1)
Prioq *prioq_new(compare_func_t compare);
-void prioq_free(Prioq *q);
+Prioq *prioq_free(Prioq *q);
int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func);
int prioq_put(Prioq *q, void *data, unsigned *idx);

View File

@ -0,0 +1,27 @@
From c374a32aa317517702ee3531f6fa59be52c4a9f0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 18 May 2015 23:38:47 +0200
Subject: [PATCH] resolved: allow DnsAnswer objects with no space for RRs
They might be created as result of merged answer sets, hence accept
them.
http://lists.freedesktop.org/archives/systemd-devel/2015-April/030834.html
(cherry picked from commit 084cea6cee1471d81e078bea4e7ee5f50a5dc009)
---
src/resolve/resolved-dns-answer.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c
index 7c4ab18b58..e08eb667cc 100644
--- a/src/resolve/resolved-dns-answer.c
+++ b/src/resolve/resolved-dns-answer.c
@@ -25,8 +25,6 @@
DnsAnswer *dns_answer_new(unsigned n) {
DnsAnswer *a;
- assert(n > 0);
-
a = malloc0(offsetof(DnsAnswer, rrs) + sizeof(DnsResourceRecord*) * n);
if (!a)
return NULL;

View File

@ -0,0 +1,400 @@
From a1b1bfdb3e18c69fe7b7665ac9f7256cf4485bbc Mon Sep 17 00:00:00 2001
From: Jan Janssen <medhefgo@web.de>
Date: Fri, 1 May 2015 15:15:16 +0200
Subject: [PATCH] journalctl: Improve boot ID lookup
This method should greatly improve offset based lookup, by simply jumping
from one boot to the next boot. It starts at the journal head to get the
a boot ID, makes a _BOOT_ID match and then comes from the opposite
journal direction (tail) to get to the end that boot. After flushing the matches
and advancing the journal from that exact position, we arrive at the start
of next boot. Rinse and repeat.
This is faster than the old method of aggregating the full boot listing just
so we can jump to a specific boot, which can be a real pain on big journals
just for a mere "-b -1" case.
As an additional benefit --list-boots should improve slightly too, because
it does less seeking.
Note that there can be a change in boot order with this lookup method
because it will use the order of boots in the journal, not the realtime stamp
stored in them. That's arguably better, though.
Another deficiency is that it will get confused with boots interleaving in the
journal, therefore, it will refuse operation in --merge, --file and --directory mode.
https://bugs.freedesktop.org/show_bug.cgi?id=72601
(cherry picked from commit 596a23293d28f93843aef86721b90043e74d3081)
---
src/journal/journalctl.c | 275 ++++++++++++++++++++++++++++++-----------------
1 file changed, 174 insertions(+), 101 deletions(-)
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 12c869f5af..c26cc00f51 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -131,6 +131,7 @@ typedef struct boot_id_t {
sd_id128_t id;
uint64_t first;
uint64_t last;
+ LIST_FIELDS(struct boot_id_t, boot_list);
} boot_id_t;
static void pager_open_if_enabled(void) {
@@ -735,6 +736,11 @@ static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
}
+ if ((arg_boot || arg_action == ACTION_LIST_BOOTS) && (arg_file || arg_directory || arg_merge)) {
+ log_error("Using --boot or --list-boots with --file, --directory or --merge is not supported.");
+ return -EINVAL;
+ }
+
return 1;
}
@@ -854,111 +860,203 @@ static int add_matches(sd_journal *j, char **args) {
return 0;
}
-static int boot_id_cmp(const void *a, const void *b) {
- uint64_t _a, _b;
+static int discover_next_boot(sd_journal *j,
+ boot_id_t **boot,
+ bool advance_older,
+ bool read_realtime) {
+ int r;
+ char match[9+32+1] = "_BOOT_ID=";
+ _cleanup_free_ boot_id_t *next_boot = NULL;
- _a = ((const boot_id_t *)a)->first;
- _b = ((const boot_id_t *)b)->first;
+ assert(j);
+ assert(boot);
- return _a < _b ? -1 : (_a > _b ? 1 : 0);
-}
+ /* We expect the journal to be on the last position of a boot
+ * (in relation to the direction we are going), so that the next
+ * invocation of sd_journal_next/previous will be from a different
+ * boot. We then collect any information we desire and then jump
+ * to the last location of the new boot by using a _BOOT_ID match
+ * coming from the other journal direction. */
-static int get_boots(sd_journal *j,
- boot_id_t **boots,
- unsigned int *count,
- boot_id_t *query_ref_boot) {
- int r;
- const void *data;
- size_t length, allocated = 0;
+ /* Make sure we aren't restricted by any _BOOT_ID matches, so that
+ * we can actually advance to a *different* boot. */
+ sd_journal_flush_matches(j);
- assert(j);
- assert(boots);
- assert(count);
+ if (advance_older)
+ r = sd_journal_previous(j);
+ else
+ r = sd_journal_next(j);
+ if (r < 0)
+ return r;
+ else if (r == 0)
+ return 0; /* End of journal, yay. */
+
+ next_boot = new0(boot_id_t, 1);
+ if (!next_boot)
+ return log_oom();
- r = sd_journal_query_unique(j, "_BOOT_ID");
+ r = sd_journal_get_monotonic_usec(j, NULL, &next_boot->id);
if (r < 0)
return r;
- *count = 0;
- SD_JOURNAL_FOREACH_UNIQUE(j, data, length) {
- boot_id_t *id;
+ if (read_realtime) {
+ r = sd_journal_get_realtime_usec(j, &next_boot->first);
+ if (r < 0)
+ return r;
+ }
- assert(startswith(data, "_BOOT_ID="));
+ /* Now seek to the last occurrence of this boot ID. */
+ sd_id128_to_string(next_boot->id, match + 9);
+ r = sd_journal_add_match(j, match, sizeof(match) - 1);
+ if (r < 0)
+ return r;
- if (!GREEDY_REALLOC(*boots, allocated, *count + 1))
- return log_oom();
+ if (advance_older)
+ r = sd_journal_seek_head(j);
+ else
+ r = sd_journal_seek_tail(j);
+ if (r < 0)
+ return r;
- id = *boots + *count;
+ if (advance_older)
+ r = sd_journal_next(j);
+ else
+ r = sd_journal_previous(j);
+ if (r < 0)
+ return r;
+ else if (r == 0)
+ return -ENODATA; /* This shouldn't happen. We just came from this very boot ID. */
- r = sd_id128_from_string(((const char *)data) + strlen("_BOOT_ID="), &id->id);
+ if (read_realtime) {
+ r = sd_journal_get_realtime_usec(j, &next_boot->last);
if (r < 0)
- continue;
+ return r;
+ }
+
+ *boot = next_boot;
+ next_boot = NULL;
+ return 0;
+}
+
+static int get_boots(sd_journal *j,
+ boot_id_t **boots,
+ boot_id_t *query_ref_boot,
+ int ref_boot_offset) {
+ bool skip_once;
+ int r, count = 0;
+ boot_id_t *head = NULL, *tail = NULL;
+ const bool advance_older = query_ref_boot && ref_boot_offset <= 0;
+
+ assert(j);
+
+ /* Adjust for the asymmetry that offset 0 is
+ * the last (and current) boot, while 1 is considered the
+ * (chronological) first boot in the journal. */
+ skip_once = query_ref_boot && sd_id128_is_null(query_ref_boot->id) && ref_boot_offset < 0;
+
+ /* Advance to the earliest/latest occurrence of our reference
+ * boot ID (taking our lookup direction into account), so that
+ * discover_next_boot() can do its job.
+ * If no reference is given, the journal head/tail will do,
+ * they're "virtual" boots after all. */
+ if (query_ref_boot && !sd_id128_is_null(query_ref_boot->id)) {
+ char match[9+32+1] = "_BOOT_ID=";
+
+ sd_journal_flush_matches(j);
- r = sd_journal_add_match(j, data, length);
+ sd_id128_to_string(query_ref_boot->id, match + 9);
+ r = sd_journal_add_match(j, match, sizeof(match) - 1);
if (r < 0)
return r;
- r = sd_journal_seek_head(j);
+ if (advance_older)
+ r = sd_journal_seek_head(j);
+ else
+ r = sd_journal_seek_tail(j);
if (r < 0)
return r;
- r = sd_journal_next(j);
+ if (advance_older)
+ r = sd_journal_next(j);
+ else
+ r = sd_journal_previous(j);
if (r < 0)
return r;
else if (r == 0)
- goto flush;
-
- r = sd_journal_get_realtime_usec(j, &id->first);
+ goto finish;
+ else if (ref_boot_offset == 0) {
+ count = 1;
+ goto finish;
+ }
+ } else {
+ if (advance_older)
+ r = sd_journal_seek_tail(j);
+ else
+ r = sd_journal_seek_head(j);
if (r < 0)
return r;
- if (query_ref_boot) {
- id->last = 0;
- if (sd_id128_equal(id->id, query_ref_boot->id))
- *query_ref_boot = *id;
- } else {
- r = sd_journal_seek_tail(j);
- if (r < 0)
- return r;
+ /* No sd_journal_next/previous here. */
+ }
- r = sd_journal_previous(j);
- if (r < 0)
- return r;
- else if (r == 0)
- goto flush;
+ while (true) {
+ _cleanup_free_ boot_id_t *current = NULL;
- r = sd_journal_get_realtime_usec(j, &id->last);
- if (r < 0)
- return r;
+ r = discover_next_boot(j, &current, advance_older, !query_ref_boot);
+ if (r < 0) {
+ boot_id_t *id, *id_next;
+ LIST_FOREACH_SAFE(boot_list, id, id_next, head)
+ free(id);
+ return r;
}
- (*count)++;
- flush:
- sd_journal_flush_matches(j);
+ if (!current)
+ break;
+
+ if (query_ref_boot) {
+ if (!skip_once)
+ ref_boot_offset += advance_older ? 1 : -1;
+ skip_once = false;
+
+ if (ref_boot_offset == 0) {
+ count = 1;
+ query_ref_boot->id = current->id;
+ break;
+ }
+ } else {
+ LIST_INSERT_AFTER(boot_list, head, tail, current);
+ tail = current;
+ current = NULL;
+ count++;
+ }
}
- qsort_safe(*boots, *count, sizeof(boot_id_t), boot_id_cmp);
- return 0;
+finish:
+ if (boots)
+ *boots = head;
+
+ sd_journal_flush_matches(j);
+
+ return count;
}
static int list_boots(sd_journal *j) {
- int r, w, i;
- unsigned int count;
- boot_id_t *id;
- _cleanup_free_ boot_id_t *all_ids = NULL;
+ int w, i, count;
+ boot_id_t *id, *id_next, *all_ids;
assert(j);
- r = get_boots(j, &all_ids, &count, NULL);
- if (r < 0)
- return r;
+ count = get_boots(j, &all_ids, NULL, 0);
+ if (count <= 0)
+ return count;
pager_open_if_enabled();
/* numbers are one less, but we need an extra char for the sign */
w = DECIMAL_STR_WIDTH(count - 1) + 1;
- for (id = all_ids, i = 0; id < all_ids + count; id++, i++) {
+ i = 0;
+ LIST_FOREACH_SAFE(boot_list, id, id_next, all_ids) {
char a[FORMAT_TIMESTAMP_MAX], b[FORMAT_TIMESTAMP_MAX];
printf("% *i " SD_ID128_FORMAT_STR " %s—%s\n",
@@ -966,39 +1064,8 @@ static int list_boots(sd_journal *j) {
SD_ID128_FORMAT_VAL(id->id),
format_timestamp_maybe_utc(a, sizeof(a), id->first),
format_timestamp_maybe_utc(b, sizeof(b), id->last));
- }
-
- return 0;
-}
-
-static int get_boot_id_by_offset(sd_journal *j, sd_id128_t *boot_id, int offset) {
- int r;
- unsigned int count;
- boot_id_t ref_boot_id = {}, *id;
- _cleanup_free_ boot_id_t *all_ids = NULL;
-
- assert(j);
- assert(boot_id);
-
- ref_boot_id.id = *boot_id;
- r = get_boots(j, &all_ids, &count, &ref_boot_id);
- if (r < 0)
- return r;
-
- if (sd_id128_equal(*boot_id, SD_ID128_NULL)) {
- if (offset > (int) count || offset <= -(int)count)
- return -EADDRNOTAVAIL;
-
- *boot_id = all_ids[(offset <= 0)*count + offset - 1].id;
- } else {
- id = bsearch(&ref_boot_id, all_ids, count, sizeof(boot_id_t), boot_id_cmp);
-
- if (!id ||
- offset <= 0 ? (id - all_ids) + offset < 0 :
- (id - all_ids) + offset >= (int) count)
- return -EADDRNOTAVAIL;
-
- *boot_id = (id + offset)->id;
+ i++;
+ free(id);
}
return 0;
@@ -1007,6 +1074,7 @@ static int get_boot_id_by_offset(sd_journal *j, sd_id128_t *boot_id, int offset)
static int add_boot(sd_journal *j) {
char match[9+32+1] = "_BOOT_ID=";
int r;
+ boot_id_t ref_boot_id = {};
assert(j);
@@ -1016,17 +1084,22 @@ static int add_boot(sd_journal *j) {
if (arg_boot_offset == 0 && sd_id128_equal(arg_boot_id, SD_ID128_NULL))
return add_match_this_boot(j, arg_machine);
- r = get_boot_id_by_offset(j, &arg_boot_id, arg_boot_offset);
- if (r < 0) {
- if (sd_id128_equal(arg_boot_id, SD_ID128_NULL))
- log_error_errno(r, "Failed to look up boot %+i: %m", arg_boot_offset);
+ ref_boot_id.id = arg_boot_id;
+ r = get_boots(j, NULL, &ref_boot_id, arg_boot_offset);
+ assert(r <= 1);
+ if (r <= 0) {
+ const char *reason = (r == 0) ? "No such boot ID in journal" : strerror(-r);
+
+ if (sd_id128_is_null(arg_boot_id))
+ log_error("Failed to look up boot %+i: %s", arg_boot_offset, reason);
else
log_error("Failed to look up boot ID "SD_ID128_FORMAT_STR"%+i: %s",
- SD_ID128_FORMAT_VAL(arg_boot_id), arg_boot_offset, strerror(-r));
- return r;
+ SD_ID128_FORMAT_VAL(arg_boot_id), arg_boot_offset, reason);
+
+ return r == 0 ? -ENODATA : r;
}
- sd_id128_to_string(arg_boot_id, match + 9);
+ sd_id128_to_string(ref_boot_id.id, match + 9);
r = sd_journal_add_match(j, match, sizeof(match) - 1);
if (r < 0)

View File

@ -0,0 +1,25 @@
From 094ea5dd03ece57d3162caf33755d76ff2399bb3 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Tue, 19 May 2015 06:33:54 +0200
Subject: [PATCH] test-hashmap: fix an assert
CID#1299016
(cherry picked from commit b669934fae49c9158c35e612e54e1765edca8584)
---
src/test/test-hashmap-plain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/test-hashmap-plain.c b/src/test/test-hashmap-plain.c
index 84b508f874..c1a5ccf1f5 100644
--- a/src/test/test-hashmap-plain.c
+++ b/src/test/test-hashmap-plain.c
@@ -682,7 +682,7 @@ static void test_hashmap_get2(void) {
r = hashmap_get2(m, key_orig, &key_copy);
assert_se(streq(r, val));
assert_se(key_orig != key_copy);
- assert_se(streq(key_orig, key_orig));
+ assert_se(streq(key_orig, key_copy));
r = hashmap_get2(m, "no such key", NULL);
assert_se(r == NULL);

View File

@ -0,0 +1,24 @@
From 97f36b10cbbcc61c6c8194be0af3bb526bab6df2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 19 May 2015 19:47:52 +0200
Subject: [PATCH] units: make sure systemd-nspawn@.slice instances are actually
located in machine.slice
https://plus.google.com/112206451048767236518/posts/SYAueyXHeEX
(cherry picked from commit 45d383a3b888195b01b58dbd2c46a11027ff5022)
---
units/systemd-nspawn@.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/units/systemd-nspawn@.service.in b/units/systemd-nspawn@.service.in
index 3e26b53fd6..5e86121130 100644
--- a/units/systemd-nspawn@.service.in
+++ b/units/systemd-nspawn@.service.in
@@ -17,6 +17,7 @@ KillMode=mixed
Type=notify
RestartForceExitStatus=133
SuccessExitStatus=133
+Slice=machine.slice
Delegate=yes
[Install]

View File

@ -185,6 +185,37 @@ Patch0144: 0144-units-set-KillMode-mixed-for-our-daemons-that-fork-w.patch
Patch0145: 0145-unit-don-t-add-automatic-dependencies-on-device-unit.patch
Patch0146: 0146-update-done-ignore-nanosecond-file-timestamp-compone.patch
Patch0147: 0147-sd-daemon-simplify-sd_pid_notify_with_fds.patch
Patch0148: 0148-timedated-correctly-set-context-on-etc-localtime.patch
Patch0149: 0149-Revert-timedated-correctly-set-context-on-etc-localt.patch
Patch0150: 0150-run-synchronously-wait-until-the-scope-unit-we-creat.patch
Patch0151: 0151-sysv-generator-test-Fix-assertion.patch
Patch0152: 0152-man-avoid-line-break-in-url.patch
Patch0153: 0153-Add-VARIANT-as-a-standard-value-for-etc-os-release.patch
Patch0154: 0154-Fix-permissions-on-run-systemd-nspawn-locks.patch
Patch0155: 0155-man-document-forwarding-to-syslog-better.patch
Patch0156: 0156-man-fix-typos-in-previous-comimt.patch
Patch0157: 0157-generators-rename-add_-root-usr-_mount-to-add_-sysro.patch
Patch0158: 0158-Generate-systemd-fsck-root.service-in-the-initramfs.patch
Patch0159: 0159-units-fix-typo-in-systemd-resolved.service.patch
Patch0160: 0160-core-don-t-consider-umask-for-SocketMode.patch
Patch0161: 0161-timedate-fix-memory-leak-in-timedated.patch
Patch0162: 0162-core-Fix-assertion-with-empty-Exec-paths.patch
Patch0163: 0163-coredump-make-sure-we-vacuum-by-default.patch
Patch0164: 0164-tmpfiles-don-t-fail-if-we-cannot-create-a-subvolume-.patch
Patch0165: 0165-zsh-completion-add-missing-completions-for-machinect.patch
Patch0166: 0166-zsh-completion-update-M-completion-for-systemd-analy.patch
Patch0167: 0167-zsh-completion-add-missing-completions-for-systemd-n.patch
Patch0168: 0168-zsh-completion-actually-run-_filter_units_by_propert.patch
Patch0169: 0169-zsh-completion-actually-complete-template-names-for-.patch
Patch0170: 0170-zsh-completion-less-forking-in-_systemctl_get_templa.patch
Patch0171: 0171-zsh-completion-less-forking-in-_systemctl_failed_uni.patch
Patch0172: 0172-zsh-completion-removing-more-pointless-forks.patch
Patch0173: 0173-zsh-completion-make-the-arrays-_sys_active_units-_sy.patch
Patch0174: 0174-resolved-fix-crash-when-shutting-down.patch
Patch0175: 0175-resolved-allow-DnsAnswer-objects-with-no-space-for-R.patch
Patch0176: 0176-journalctl-Improve-boot-ID-lookup.patch
Patch0177: 0177-test-hashmap-fix-an-assert.patch
Patch0178: 0178-units-make-sure-systemd-nspawn-.slice-instances-are-.patch
# kernel-install patch for grubby, drop if grubby is obsolete
@ -1015,6 +1046,14 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
%changelog
* Wed May 20 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 219-14
- Remove presets (#1221340)
- Fix (potential) crash and memory leak in timedated, locking failure
in systemd-nspawn, crash in resolved.
- journalctl --list-boots should be faster
- zsh completions are improved
- various ommissions in docs are corrected (#1147651)
- VARIANT and VARIANT_ID fields in os-release are documented
- systemd-fsck-root.service is generated in the initramfs (#1201979, #1107818)
- systemd-tmpfiles should behave better on read-only file systems (#1207083)
* Wed Apr 29 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 219-13
- Patches for some outstanding annoyances