[systemd-commits] 4 commits - man/systemd.device.xml src/journal src/nspawn src/shared

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Wed Dec 11 19:41:26 PST 2013


 man/systemd.device.xml   |   43 ++++++++++++++++++++++++++-----------------
 src/journal/journalctl.c |   14 ++++++++++++--
 src/nspawn/nspawn.c      |   23 +++++++++++++++++++----
 src/shared/log.c         |    3 +++
 4 files changed, 60 insertions(+), 23 deletions(-)

New commits:
commit 4d680aeea1e479f08f3dbdb7430def5d9eefe2ee
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Dec 11 22:00:33 2013 -0500

    nspawn: complain and continue if machine has same id
    
    If --link-journal=host or --link-journal=guest is used, this totally
    cannot work and we exit with an error. If however --link-journal=auto
    or --link-journal=no is used, just display a warning.
    
    Having the same machine id can happen if booting from the same
    filesystem as the host. Since other things mostly function correctly,
    let's allow that.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=68369

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index b3ca10e..c5faac4 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -804,14 +804,11 @@ static int setup_hostname(void) {
 }
 
 static int setup_journal(const char *directory) {
-        sd_id128_t machine_id;
+        sd_id128_t machine_id, this_id;
         _cleanup_free_ char *p = NULL, *b = NULL, *q = NULL, *d = NULL;
         char *id;
         int r;
 
-        if (arg_link_journal == LINK_NO)
-                return 0;
-
         p = strappend(directory, "/etc/machine-id");
         if (!p)
                 return log_oom();
@@ -835,6 +832,24 @@ static int setup_journal(const char *directory) {
                 return r;
         }
 
+        r = sd_id128_get_machine(&this_id);
+        if (r < 0) {
+                log_error("Failed to retrieve machine ID: %s", strerror(-r));
+                return r;
+        }
+
+        if (sd_id128_equal(machine_id, this_id)) {
+                log_full(arg_link_journal == LINK_AUTO ? LOG_WARNING : LOG_ERR,
+                         "Host and machine ids are equal (%s): refusing to link journals", id);
+                if (arg_link_journal == LINK_AUTO)
+                        return 0;
+                return
+                        -EEXIST;
+        }
+
+        if (arg_link_journal == LINK_NO)
+                return 0;
+
         free(p);
         p = strappend("/var/log/journal/", id);
         q = strjoin(directory, "/var/log/journal/", id, NULL);

commit 50f72bca65ad291685e5b79903cb6ac3fbc8364d
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Dec 11 20:34:19 2013 -0500

    Do not log all assert_return failures
    
    % build/journalctl help
    Assertion 'match_is_valid(data, size)' failed at ../src/journal/sd-journal.c:227, function sd_journal_add_match(). Ignoring.
    
    Callers cannot be expect to check all arguments always.

diff --git a/src/shared/log.c b/src/shared/log.c
index 2531e0d..c654b86 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -690,6 +690,9 @@ int log_meta_object(
 static void log_assert(int level, const char *text, const char *file, int line, const char *func, const char *format) {
         static char buffer[LINE_MAX];
 
+        if (_likely_(LOG_PRI(level) > log_max_level))
+                return;
+
         snprintf(buffer, sizeof(buffer), format, text, file, line, func);
 
         char_array_0(buffer);

commit faf5077f891aa249270b2a3d9f0104c3eec02da6
Author: Djalal Harouni <tixxdz at opendz.org>
Date:   Thu Dec 12 00:22:48 2013 +0100

    journal: pipe journalctl help output into a pager
    
    journalctl help output might run off the screen, so be consistent
    as other systemd tools do and pipe it into a pager.

diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5d12c2b..cc338e0 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -114,8 +114,18 @@ typedef struct boot_id_t {
         uint64_t last;
 } boot_id_t;
 
+static void pager_open_if_enabled(void) {
+
+        if (arg_no_pager)
+                return;
+
+        pager_open(arg_pager_end);
+}
+
 static int help(void) {
 
+        pager_open_if_enabled();
+
         printf("%s [OPTIONS...] [MATCHES...]\n\n"
                "Query the journal.\n\n"
                "Flags:\n"
@@ -1647,8 +1657,8 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        if (!arg_no_pager && !arg_follow)
-                pager_open(arg_pager_end);
+        if (!arg_follow)
+                pager_open_if_enabled();
 
         if (!arg_quiet) {
                 usec_t start, end;

commit 05b92756f74943a3d8c3ad13f5688c7dd22bd9ab
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sun Dec 8 10:38:33 2013 -0500

    man: mention SYSTEMD_USER_WANTS
    
    Also split into paragraphs for easier reading and make a few minor
    corrections.

diff --git a/man/systemd.device.xml b/man/systemd.device.xml
index 002b647..1bbd322 100644
--- a/man/systemd.device.xml
+++ b/man/systemd.device.xml
@@ -102,28 +102,35 @@
                 <variablelist class='udev-directives'>
                         <varlistentry>
                                 <term><varname>SYSTEMD_WANTS=</varname></term>
+                                <term><varname>SYSTEMD_USER_WANTS=</varname></term>
                                 <listitem><para>Adds dependencies of
-                                type <varname>Wants</varname> from
-                                the device unit to all listed units. This
-                                may be used to activate arbitrary
-                                units when a specific device becomes
-                                available. Note that this and the
+                                type <varname>Wants</varname> from the
+                                device unit to all listed units. The
+                                first form is used by the system
+                                systemd instance, the second by user
+                                systemd instances. Those settings may
+                                be used to activate arbitrary units
+                                when a specific device becomes
+                                available.</para>
+
+                                <para>Note that this and the
                                 other tags are not taken into account
                                 unless the device is tagged with the
                                 <literal>systemd</literal> string in
                                 the udev database, because otherwise
-                                the device is not exposed as systemd
-                                unit (see above). Note that systemd
-                                will only act on
-                                <varname>Wants</varname> dependencies
-                                when a device first becomes active, it
-                                will not act on them if they are added
-                                to devices that are already
-                                active. Use
+                                the device is not exposed as a systemd
+                                unit (see above).</para>
+
+                                <para>Note that systemd will only act
+                                on <varname>Wants</varname>
+                                dependencies when a device first
+                                becomes active. It will not act on
+                                them if they are added to devices that
+                                are already active. Use
                                 <varname>SYSTEMD_READY=</varname> (see
                                 below) to influence on which udev
-                                event to trigger the device
-                                dependencies.</para></listitem>
+                                event to trigger the dependencies.
+                                </para></listitem>
                         </varlistentry>
 
                         <varlistentry>
@@ -142,11 +149,13 @@
                                 even if it shows up in the udev
                                 tree. If this property is unset or set
                                 to 1, the device will be considered
-                                plugged the moment it shows up in the
+                                plugged if it visible in the
                                 udev tree. This property has no
                                 influence on the behavior when a
                                 device disappears from the udev
-                                tree. This option is useful to support
+                                tree.</para>
+
+                                <para>This option is useful to support
                                 devices that initially show up in an
                                 uninitialized state in the tree, and
                                 for which a <literal>changed</literal>



More information about the systemd-commits mailing list