[systemd-commits] 12 commits - autogen.sh hwdb/60-keyboard.hwdb man/journalctl.xml man/systemd-nspawn.xml src/gpt-auto-generator src/journal src/readahead src/shared src/udev TODO units/kmod-static-nodes.service.in

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Tue Aug 20 18:22:46 PDT 2013


 TODO                                        |    6 +
 autogen.sh                                  |    2 
 hwdb/60-keyboard.hwdb                       |    9 ++
 man/journalctl.xml                          |   25 ++++++--
 man/systemd-nspawn.xml                      |    9 +-
 src/gpt-auto-generator/gpt-auto-generator.c |   87 ++++++++++++----------------
 src/journal/journalctl.c                    |    5 -
 src/journal/journald-stream.c               |    2 
 src/journal/journald-syslog.c               |   12 ++-
 src/journal/journald-syslog.h               |    2 
 src/journal/sd-journal.c                    |   10 +--
 src/readahead/readahead-collect.c           |    2 
 src/shared/logs-show.c                      |   55 ++++++++++++++---
 src/shared/macro.h                          |    2 
 src/shared/output-mode.h                    |    3 
 src/shared/time-util.c                      |   22 +++++++
 src/shared/time-util.h                      |    1 
 src/shared/util.c                           |    4 -
 src/udev/udev-rules.c                       |   14 +++-
 units/kmod-static-nodes.service.in          |    1 
 20 files changed, 179 insertions(+), 94 deletions(-)

New commits:
commit cf40f0be1acc73ea7dfb9aabc213f6a762ea62d2
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Aug 7 22:55:29 2013 -0400

    logs-show: show source timestamp in verbose mode
    
    This makes verbose behave like short mode, i.e. try to show
    the source timestamp, and fall back to journald timestamp
    only if unavailable or unparsable. I think verbose should
    be like short, only showing more fields, and showing different
    timestamps would be confusing.

diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 7002675..89a73a5 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -399,11 +399,35 @@ static int output_verbose(
 
         sd_journal_set_data_threshold(j, 0);
 
-        r = sd_journal_get_realtime_usec(j, &realtime);
-        if (r < 0) {
+        r = sd_journal_get_data(j, "_SOURCE_REALTIME_TIMESTAMP", &data, &length);
+        if (r == -ENOENT)
+                log_debug("Source realtime timestamp not found");
+        else if (r < 0) {
                 log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_ERR,
-                         "Failed to get realtime timestamp: %s", strerror(-r));
+                         "Failed to get source realtime timestamp: %s", strerror(-r));
                 return r;
+        } else {
+                _cleanup_free_ char *value = NULL;
+                size_t size;
+
+                r = parse_field(data, length, "_SOURCE_REALTIME_TIMESTAMP=", &value, &size);
+                if (r < 0)
+                        log_debug("_SOURCE_REALTIME_TIMESTAMP invalid: %s", strerror(-r));
+                else {
+                        r = safe_atou64(value, &realtime);
+                        if (r < 0)
+                                log_debug("Failed to parse realtime timestamp: %s",
+                                          strerror(-r));
+                }
+        }
+
+        if (r < 0) {
+                r = sd_journal_get_realtime_usec(j, &realtime);
+                if (r < 0) {
+                        log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_ERR,
+                                 "Failed to get realtime timestamp: %s", strerror(-r));
+                        return r;
+                }
         }
 
         r = sd_journal_get_cursor(j, &cursor);

commit f02d836794d519e717e51d81501557da55915ce2
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sun Aug 4 09:04:20 2013 -0400

    logs-show: add short-precise mode with us timestamps
    
    Also, always show us timestamps in verbose mode.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=991678

diff --git a/man/journalctl.xml b/man/journalctl.xml
index dcc6d5d..8680e53 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -253,12 +253,11 @@
 
                                         <varlistentry>
                                                 <term>
-                                                        <option>short-monotonic</option>
+                                                        <option>short-iso</option>
                                                 </term>
                                                 <listitem>
-                                                        <para>is very similar
-                                                        but shows monotonic
-                                                        timestamps instead of
+                                                        <para>is very similar,
+                                                        but shows ISO 8601
                                                         wallclock timestamps.
                                                         </para>
                                                 </listitem>
@@ -266,11 +265,25 @@
 
                                         <varlistentry>
                                                 <term>
-                                                        <option>short-iso</option>
+                                                        <option>short-precise</option>
                                                 </term>
                                                 <listitem>
                                                         <para>is very similar,
-                                                        but shows ISO 8601
+                                                        but shows timestamps
+                                                        with full microsecond
+                                                        precision.
+                                                        </para>
+                                                </listitem>
+                                        </varlistentry>
+
+                                        <varlistentry>
+                                                <term>
+                                                        <option>short-monotonic</option>
+                                                </term>
+                                                <listitem>
+                                                        <para>is very similar
+                                                        but shows monotonic
+                                                        timestamps instead of
                                                         wallclock timestamps.
                                                         </para>
                                                 </listitem>
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5cf9390..27c148e 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -134,8 +134,9 @@ static int help(void) {
                "  -n --lines[=INTEGER]     Number of journal entries to show\n"
                "     --no-tail             Show all lines, even in follow mode\n"
                "  -r --reverse             Show the newest entries first\n"
-               "  -o --output=STRING       Change journal output mode (short, short-monotonic, short-iso\n"
-               "                           verbose, export, json, json-pretty, json-sse, cat)\n"
+               "  -o --output=STRING       Change journal output mode (short, short-iso,\n"
+               "                           short-precise, short-monotonic, verbose,\n"
+               "                           export, json, json-pretty, json-sse, cat)\n"
                "  -x --catalog             Add message explanations where available\n"
                "  -l --full                Do not ellipsize fields\n"
                "  -a --all                 Show all fields, including long and unprintable\n"
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index af738a3..7002675 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -318,10 +318,21 @@ static int output_short(
                 }
 
                 t = (time_t) (x / USEC_PER_SEC);
-                if (mode == OUTPUT_SHORT_ISO)
+
+                switch(mode) {
+                case OUTPUT_SHORT_ISO:
                         r = strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S%z", localtime_r(&t, &tm));
-                else
+                        break;
+                case OUTPUT_SHORT_PRECISE:
+                        r = strftime(buf, sizeof(buf), "%b %d %H:%M:%S", localtime_r(&t, &tm));
+                        if (r > 0) {
+                                snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
+                                         ".%06llu", x % USEC_PER_SEC);
+                        }
+                        break;
+                default:
                         r = strftime(buf, sizeof(buf), "%b %d %H:%M:%S", localtime_r(&t, &tm));
+                }
 
                 if (r <= 0) {
                         log_error("Failed to format time.");
@@ -380,7 +391,7 @@ static int output_verbose(
         size_t length;
         _cleanup_free_ char *cursor = NULL;
         uint64_t realtime;
-        char ts[FORMAT_TIMESTAMP_MAX];
+        char ts[FORMAT_TIMESTAMP_MAX + 7];
         int r;
 
         assert(f);
@@ -402,7 +413,7 @@ static int output_verbose(
         }
 
         fprintf(f, "%s [%s]\n",
-                format_timestamp(ts, sizeof(ts), realtime),
+                format_timestamp_us(ts, sizeof(ts), realtime),
                 cursor);
 
         JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
@@ -849,8 +860,9 @@ static int (*output_funcs[_OUTPUT_MODE_MAX])(
                 OutputFlags flags) = {
 
         [OUTPUT_SHORT] = output_short,
-        [OUTPUT_SHORT_MONOTONIC] = output_short,
         [OUTPUT_SHORT_ISO] = output_short,
+        [OUTPUT_SHORT_PRECISE] = output_short,
+        [OUTPUT_SHORT_MONOTONIC] = output_short,
         [OUTPUT_VERBOSE] = output_verbose,
         [OUTPUT_EXPORT] = output_export,
         [OUTPUT_JSON] = output_json,
@@ -1131,8 +1143,9 @@ int show_journal_by_unit(
 
 static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {
         [OUTPUT_SHORT] = "short",
-        [OUTPUT_SHORT_MONOTONIC] = "short-monotonic",
         [OUTPUT_SHORT_ISO] = "short-iso",
+        [OUTPUT_SHORT_PRECISE] = "short-precise",
+        [OUTPUT_SHORT_MONOTONIC] = "short-monotonic",
         [OUTPUT_VERBOSE] = "verbose",
         [OUTPUT_EXPORT] = "export",
         [OUTPUT_JSON] = "json",
diff --git a/src/shared/output-mode.h b/src/shared/output-mode.h
index 4012889..9da789d 100644
--- a/src/shared/output-mode.h
+++ b/src/shared/output-mode.h
@@ -23,8 +23,9 @@
 
 typedef enum OutputMode {
         OUTPUT_SHORT,
-        OUTPUT_SHORT_MONOTONIC,
         OUTPUT_SHORT_ISO,
+        OUTPUT_SHORT_PRECISE,
+        OUTPUT_SHORT_MONOTONIC,
         OUTPUT_VERBOSE,
         OUTPUT_EXPORT,
         OUTPUT_JSON,
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 9ee711a..860be61 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -168,6 +168,28 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
         return buf;
 }
 
+char *format_timestamp_us(char *buf, size_t l, usec_t t) {
+        struct tm tm;
+        time_t sec;
+
+        assert(buf);
+        assert(l > 0);
+
+        if (t <= 0)
+                return NULL;
+
+        sec = (time_t) (t / USEC_PER_SEC);
+        localtime_r(&sec, &tm);
+
+        if (strftime(buf, l, "%a %Y-%m-%d %H:%M:%S", &tm) <= 0)
+                return NULL;
+        snprintf(buf + strlen(buf), l - strlen(buf), ".%06llu", t % USEC_PER_SEC);
+        if (strftime(buf + strlen(buf), l - strlen(buf), " %Z", &tm) <= 0)
+                return NULL;
+
+        return buf;
+}
+
 char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
         usec_t n, d;
 
diff --git a/src/shared/time-util.h b/src/shared/time-util.h
index f27a006..7660fe1 100644
--- a/src/shared/time-util.h
+++ b/src/shared/time-util.h
@@ -73,6 +73,7 @@ usec_t timeval_load(const struct timeval *tv) _pure_;
 struct timeval *timeval_store(struct timeval *tv, usec_t u);
 
 char *format_timestamp(char *buf, size_t l, usec_t t);
+char *format_timestamp_us(char *buf, size_t l, usec_t t);
 char *format_timestamp_relative(char *buf, size_t l, usec_t t);
 char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy);
 

commit c51cf05646a11c65daf65c1123c77efb068f4f7b
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 15 23:13:48 2013 -0400

    Rename F_TYPE_CMP() to F_TYPE_EQUAL()

diff --git a/TODO b/TODO
index 5c5e4b4..9bc14fd 100644
--- a/TODO
+++ b/TODO
@@ -57,8 +57,6 @@ Features:
 
 * better error message if you run systemctl without systemd running
 
-* rename F_TYPE_CMP() to F_TYPE_EQUAL()
-
 * unlink PID files of units after exit
 
 * tiny tool that saves/restores backlight
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 5c0e455..880661e 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -434,7 +434,7 @@ static int get_block_device(const char *path, dev_t *dev) {
         if (statfs("/", &sfs) < 0)
                 return -errno;
 
-        if (F_TYPE_CMP(sfs.f_type, BTRFS_SUPER_MAGIC))
+        if (F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC))
                 return get_btrfs_block_device(path, dev);
 
         return 0;
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index a83c0c2..7700d6c 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1266,11 +1266,11 @@ static void check_network(sd_journal *j, int fd) {
                 return;
 
         j->on_network =
-                F_TYPE_CMP(sfs.f_type, CIFS_MAGIC_NUMBER) ||
-                F_TYPE_CMP(sfs.f_type, CODA_SUPER_MAGIC) ||
-                F_TYPE_CMP(sfs.f_type, NCP_SUPER_MAGIC) ||
-                F_TYPE_CMP(sfs.f_type, NFS_SUPER_MAGIC) ||
-                F_TYPE_CMP(sfs.f_type, SMB_SUPER_MAGIC);
+                F_TYPE_EQUAL(sfs.f_type, CIFS_MAGIC_NUMBER) ||
+                F_TYPE_EQUAL(sfs.f_type, CODA_SUPER_MAGIC) ||
+                F_TYPE_EQUAL(sfs.f_type, NCP_SUPER_MAGIC) ||
+                F_TYPE_EQUAL(sfs.f_type, NFS_SUPER_MAGIC) ||
+                F_TYPE_EQUAL(sfs.f_type, SMB_SUPER_MAGIC);
 }
 
 static bool file_has_type_prefix(const char *prefix, const char *filename) {
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 5d37bb7..32888ad 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -510,7 +510,7 @@ done:
         on_ssd = fs_on_ssd(root) > 0;
         log_debug("On SSD: %s", yes_no(on_ssd));
 
-        on_btrfs = statfs(root, &sfs) >= 0 && F_TYPE_CMP(sfs.f_type, BTRFS_SUPER_MAGIC);
+        on_btrfs = statfs(root, &sfs) >= 0 && F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC);
         log_debug("On btrfs: %s", yes_no(on_btrfs));
 
         if (asprintf(&pack_fn_new, "%s/.readahead.new", root) < 0) {
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 969329d..0d3ff1c 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -273,7 +273,7 @@ do {                                                                    \
   * the const magic to the type, otherwise the compiler warns about
   * signed/unsigned comparison, because the magic can be 32 bit unsigned.
  */
-#define F_TYPE_CMP(a, b) (a == (typeof(a)) b)
+#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b)
 
 
 /* Returns the number of chars needed to format variables of the
diff --git a/src/shared/util.c b/src/shared/util.c
index f23dd92..ca9c2eb 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2830,8 +2830,8 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
 _pure_ static int is_temporary_fs(struct statfs *s) {
         assert(s);
         return
-                F_TYPE_CMP(s->f_type, TMPFS_MAGIC) ||
-                F_TYPE_CMP(s->f_type, RAMFS_MAGIC);
+                F_TYPE_EQUAL(s->f_type, TMPFS_MAGIC) ||
+                F_TYPE_EQUAL(s->f_type, RAMFS_MAGIC);
 }
 
 int rm_rf_children(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev) {

commit e7627e14dc883ab0ad73c931e4ff0caa1cad6860
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 15 21:40:56 2013 -0400

    keymap: add Pavilion dv7 keys

diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
index a77aa00..4e7c1a2 100644
--- a/hwdb/60-keyboard.hwdb
+++ b/hwdb/60-keyboard.hwdb
@@ -374,12 +374,19 @@ keyboard:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*[tT][aA][bB][lL][eE][tT]*:pvr*
  KEYBOARD_KEY_86=pageup
  KEYBOARD_KEY_87=pagedown
 
-# Pavillion
+# Pavilion
 keyboard:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*[pP][aA][vV][iI][lL][iI][oO][nN]*:pvr*
  KEYBOARD_KEY_88=media                                  # FIXME: quick play
+ KEYBOARD_KEY_b7=print
  KEYBOARD_KEY_d8=!f23                                   # touchpad off
  KEYBOARD_KEY_d9=!f22                                   # touchpad on
 
+keyboard:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnHP Pavilion dv7 Notebook PC:pvr*
+ KEYBOARD_KEY_b7=print
+ KEYBOARD_KEY_c2=media                                  # FIXME: quick play
+ KEYBOARD_KEY_c6=break
+ KEYBOARD_KEY_94=0
+
 # Elitebook
 keyboard:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*Compaq*:pvr*
 keyboard:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*EliteBook*:pvr*

commit 1291bc895b3dc52fbf7f4c3a04507c14428c4152
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 15 20:01:19 2013 -0400

    udev: when complaining about invalid characters, print them out
    
    systemd-udevd[6260]: invalid key/value pair in file /usr/lib/udev/rules.d/60-ffado.rules on line 46,starting at character 84 ('#')

diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index e4facd7..1634812 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -34,6 +34,7 @@
 #include "conf-files.h"
 #include "strbuf.h"
 #include "strv.h"
+#include "util.h"
 
 #define PREALLOC_TOKEN          2048
 
@@ -1069,10 +1070,17 @@ static int add_rule(struct udev_rules *rules, char *line,
                 if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) {
                         /* If we aren't at the end of the line, this is a parsing error.
                          * Make a best effort to describe where the problem is. */
-                        if (*linepos != '\n')
+                        if (*linepos != '\n') {
+                                char buf[2] = {linepos[1]};
+                                _cleanup_free_ char *tmp;
+
+                                tmp = cescape(buf);
                                 log_error("invalid key/value pair in file %s on line %u,"
-                                                "starting at character %lu\n",
-                                                filename, lineno, linepos - line + 1);
+                                          "starting at character %lu ('%s')\n",
+                                          filename, lineno, linepos - line + 1, tmp);
+                                if (linepos[1] == '#')
+                                        log_info("hint: comments can only start at beginning of line");
+                        }
                         break;
                 }
 

commit 091526ab20485492124852dcf629787f35816df8
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 15 18:42:42 2013 -0400

    gpt-auto-generator: do not show error for non-GPT disks

diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 222d6a0..5c0e455 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -87,7 +87,8 @@ static int verify_gpt_partition(dev_t dev, sd_id128_t *type, unsigned *nr, char
         errno = 0;
         r = blkid_probe_lookup_value(b, "PART_ENTRY_SCHEME", &v, NULL);
         if (r != 0)
-                return errno ? -errno : -EIO;
+                /* return 0 if we're not on GPT */
+                return errno ? -errno : 0;
 
         if (strcmp(v, "gpt") != 0)
                 return 0;

commit 7384146530ac083efbef62b9ef5bb82c56565cd4
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 15 18:24:10 2013 -0400

    gpt-auto-generator: use _cleanup_ for blkid_free_probe

diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 60cbd7e..222d6a0 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -49,9 +49,15 @@
 
 static const char *arg_dest = "/tmp";
 
+static inline void blkid_free_probep(blkid_probe *b) {
+        if (*b)
+                blkid_free_probe(*b);
+}
+#define _cleanup_blkid_freep_probe_ _cleanup_(blkid_free_probep)
+
 static int verify_gpt_partition(dev_t dev, sd_id128_t *type, unsigned *nr, char **fstype) {
         _cleanup_free_ char *t = NULL;
-        blkid_probe b = NULL;
+        _cleanup_blkid_freep_probe_ blkid_probe b = NULL;
         const char *v;
         int r;
 
@@ -61,12 +67,8 @@ static int verify_gpt_partition(dev_t dev, sd_id128_t *type, unsigned *nr, char
 
         errno = 0;
         b = blkid_new_probe_from_filename(t);
-        if (!b) {
-                if (errno != 0)
-                        return -errno;
-
-                return -ENOMEM;
-        }
+        if (!b)
+                return errno != 0 ? -errno : -ENOMEM;
 
         blkid_probe_enable_superblocks(b, 1);
         blkid_probe_set_superblocks_flags(b, BLKID_SUBLKS_TYPE);
@@ -75,36 +77,26 @@ static int verify_gpt_partition(dev_t dev, sd_id128_t *type, unsigned *nr, char
 
         errno = 0;
         r = blkid_do_safeprobe(b);
-        if (r == -2) {
-                r = -ENODEV;
-                goto finish;
-        } else if (r == 1) {
-                r = -ENODEV;
-                goto finish;
-        } else if (r != 0) {
-                r = errno ? -errno : -EIO;
-                goto finish;
-        }
+        if (r == -2)
+                return -ENODEV;
+        else if (r == 1)
+                return -ENODEV;
+        else if (r != 0)
+                return errno ? -errno : -EIO;
 
         errno = 0;
         r = blkid_probe_lookup_value(b, "PART_ENTRY_SCHEME", &v, NULL);
-        if (r != 0) {
-                r = errno ? -errno : -EIO;
-                goto finish;
-        }
+        if (r != 0)
+                return errno ? -errno : -EIO;
 
-        if (strcmp(v, "gpt") != 0) {
-                r = 0;
-                goto finish;
-        }
+        if (strcmp(v, "gpt") != 0)
+                return 0;
 
         if (type) {
                 errno = 0;
                 r = blkid_probe_lookup_value(b, "PART_ENTRY_TYPE", &v, NULL);
-                if (r != 0) {
-                        r = errno ? -errno : -EIO;
-                        goto finish;
-                }
+                if (r != 0)
+                        return errno ? -errno : -EIO;
 
                 r = sd_id128_from_string(v, type);
                 if (r < 0)
@@ -114,10 +106,8 @@ static int verify_gpt_partition(dev_t dev, sd_id128_t *type, unsigned *nr, char
         if (nr) {
                 errno = 0;
                 r = blkid_probe_lookup_value(b, "PART_ENTRY_NUMBER", &v, NULL);
-                if (r != 0) {
-                        r = errno ? -errno : -EIO;
-                        goto finish;
-                }
+                if (r != 0)
+                        return errno ? -errno : -EIO;
 
                 r = safe_atou(v, nr);
                 if (r < 0)
@@ -134,22 +124,14 @@ static int verify_gpt_partition(dev_t dev, sd_id128_t *type, unsigned *nr, char
                         *fstype = NULL;
                 else {
                         fst = strdup(v);
-                        if (!fst) {
-                                r = -ENOMEM;
-                                goto finish;
-                        }
+                        if (!fst)
+                                return -ENOMEM;
 
                         *fstype = fst;
                 }
         }
 
         return 1;
-
-finish:
-        if (b)
-                blkid_free_probe(b);
-
-        return r;
 }
 
 static int add_swap(const char *path, const char *fstype) {

commit d98cc1c019651b895464161072894a02cc43daab
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 15 18:05:04 2013 -0400

    gpt-auto-generator: include device name in error reports

diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index a26655f..60cbd7e 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -299,7 +299,8 @@ static int enumerate_partitions(dev_t dev) {
 
         r = udev_enumerate_scan_devices(e);
         if (r < 0) {
-                log_error("Failed to enumerate partitions: %s", strerror(-r));
+                log_error("Failed to enumerate partitions on /dev/block/%u:%u: %s",
+                          major(dev), minor(dev), strerror(-r));
                 goto finish;
         }
 
@@ -310,6 +311,7 @@ static int enumerate_partitions(dev_t dev) {
                 struct udev_device *q;
                 sd_id128_t type_id;
                 unsigned nr;
+                dev_t sub;
 
                 q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
                 if (!q) {
@@ -329,9 +331,12 @@ static int enumerate_partitions(dev_t dev) {
                         goto finish;
                 }
 
-                r = verify_gpt_partition(udev_device_get_devnum(q), &type_id, &nr, &fstype);
+                sub = udev_device_get_devnum(q);
+
+                r = verify_gpt_partition(sub, &type_id, &nr, &fstype);
                 if (r < 0) {
-                        log_error("Failed to verify GPT partition: %s", strerror(-r));
+                        log_error("Failed to verify GPT partition /dev/block/%u:%u: %s",
+                                  major(sub), minor(sub), strerror(-r));
                         udev_device_unref(q);
                         goto finish;
                 }
@@ -483,11 +488,12 @@ int main(int argc, char *argv[]) {
                 return EXIT_SUCCESS;
         }
 
-        log_debug("Root device %u:%u.", major(dev), minor(dev));
+        log_debug("Root device /dev/block/%u:%u.", major(dev), minor(dev));
 
         r = verify_gpt_partition(dev, NULL, NULL, NULL);
         if (r < 0) {
-                log_error("Failed to verify GPT partition: %s", strerror(-r));
+                log_error("Failed to verify GPT partition /dev/block/%u:%u: %s",
+                          major(dev), minor(dev), strerror(-r));
                 return EXIT_FAILURE;
         }
         if (r == 0)

commit 219061dc524368179b2e65cfe91d4d6b23396ba8
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Aug 19 16:59:42 2013 -0400

    units: disable kmod-static-nodes.service in containers
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=998122.
    
    Note: upstream kmod has a patch [1] to exit with a warning if
    modules.devname is missing. We could use new %v specifier to make this
    service conditional on the existence of this file, but this could
    mask a kernel installation error, hence we should let kmod run
    even if the file doesn't exist.
    
    [1] http://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=ae17710117

diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in
index cdfc6e5..98664ea 100644
--- a/units/kmod-static-nodes.service.in
+++ b/units/kmod-static-nodes.service.in
@@ -9,6 +9,7 @@
 Description=Create list of required static device nodes for the current kernel
 DefaultDependencies=no
 Before=sysinit.target systemd-tmpfiles-setup-dev.service
+ConditionVirtualization=!container
 
 [Service]
 Type=oneshot

commit 04ac799283f517672a5424e7c5bf066cfa4ca020
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Aug 19 16:00:13 2013 -0400

    man: fix spacing issue in systemd-nspawn(1)
    
    Same as 1e158d273.

diff --git a/TODO b/TODO
index f6e7566..5c5e4b4 100644
--- a/TODO
+++ b/TODO
@@ -23,6 +23,10 @@ Bugfixes:
   - make the resulting line the requested number of *characters*, not *bytes*,
   - avoid truncuating multi-byte sequences in the middle.
 
+* shorten the message to sane length:
+
+  Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory. See system logs and 'systemctl status display-manager.service' for details.
+
 Fedora 20:
 
 * external: ps should gain colums for slice and machine
diff --git a/man/systemd-nspawn.xml b/man/systemd-nspawn.xml
index f4c5d77..e55933d0 100644
--- a/man/systemd-nspawn.xml
+++ b/man/systemd-nspawn.xml
@@ -97,14 +97,13 @@
                 involved with boot and systems management.</para>
 
                 <para>In contrast to
-                <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
-                <command>systemd-nspawn</command> may be used to boot
-                full Linux-based operating systems in a
-                container.</para>
+                <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>1</manvolnum></citerefentry> <command>systemd-nspawn</command>
+                may be used to boot full Linux-based operating systems
+                in a container.</para>
 
                 <para>Use a tool like
                 <citerefentry><refentrytitle>yum</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-                <citerefentry><refentrytitle>debootstrap</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                <citerefentry><refentrytitle>debootstrap</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                 or
                 <citerefentry><refentrytitle>pacman</refentrytitle><manvolnum>8</manvolnum></citerefentry>
                 to set up an OS directory tree suitable as file system

commit 58a25dac28b14b798299935ed0fd400965da4623
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Aug 19 19:24:01 2013 -0400

    build-sys: use no-tmpl flavour of gtkdocization
    
    "tmpl" flavour is deprecated. Also this way we avoid a warning during
    installation with older gtkdoc.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701259

diff --git a/autogen.sh b/autogen.sh
index 86fe9b3..eeb0c1b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -25,7 +25,7 @@ if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then
 fi
 
 if which gtkdocize >/dev/null 2>/dev/null; then
-        gtkdocize --docdir docs/
+        gtkdocize --docdir docs/ --flavour no-tmpl
         gtkdocargs=--enable-gtk-doc
 else
         echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation."

commit ac50788b0f5aeee09e7d45db28ae8ab7f39cd52e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Fri Jul 26 12:57:33 2013 -0400

    journal: fix parsing of facility in syslog messages
    
    In 49998b383 (journald: do not overwrite syslog facility when
    parsing priority) journald started ignoring facility part when
    reading service stderr to convert to syslog messages. In this
    case it is fine, because only the priority is allowed.
    
    But the same codepath is used for syslog messages, where the
    facility should be used. Split the two codepaths by explicitly
    specyfing whether the facility should be ignored or not.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=988814

diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index e98fe94..9c4efec 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -90,7 +90,7 @@ static int stdout_stream_log(StdoutStream *s, const char *p) {
         priority = s->priority;
 
         if (s->level_prefix)
-                syslog_parse_priority((char**) &p, &priority);
+                syslog_parse_priority((char**) &p, &priority, false);
 
         if (s->forward_to_syslog || s->server->forward_to_syslog)
                 server_forward_syslog(s->server, syslog_fixup_facility(priority), s->identifier, p, &s->ucred, NULL);
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index 7cbb346..c2770a5 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -236,7 +236,7 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid)
         return e;
 }
 
-void syslog_parse_priority(char **p, int *priority) {
+void syslog_parse_priority(char **p, int *priority, bool with_facility) {
         int a = 0, b = 0, c = 0;
         int k;
 
@@ -265,10 +265,14 @@ void syslog_parse_priority(char **p, int *priority) {
         } else
                 return;
 
-        if (a < 0 || b < 0 || c < 0)
+        if (a < 0 || b < 0 || c < 0 ||
+            (!with_facility && (a || b || c > 7)))
                 return;
 
-        *priority = (*priority & LOG_FACMASK) | (a*100 + b*10 + c);
+        if (with_facility)
+                *priority = a*100 + b*10 + c;
+        else
+                *priority = (*priority & LOG_FACMASK) | c;
         *p += k;
 }
 
@@ -361,7 +365,7 @@ void server_process_syslog_message(
         assert(buf);
 
         orig = buf;
-        syslog_parse_priority((char**) &buf, &priority);
+        syslog_parse_priority((char**) &buf, &priority, true);
 
         if (s->forward_to_syslog)
                 forward_syslog_raw(s, priority, orig, ucred, tv);
diff --git a/src/journal/journald-syslog.h b/src/journal/journald-syslog.h
index 324b70e..8ccdb77 100644
--- a/src/journal/journald-syslog.h
+++ b/src/journal/journald-syslog.h
@@ -25,7 +25,7 @@
 
 int syslog_fixup_facility(int priority) _const_;
 
-void syslog_parse_priority(char **p, int *priority);
+void syslog_parse_priority(char **p, int *priority, bool with_facility);
 size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid);
 
 void server_forward_syslog(Server *s, int priority, const char *identifier, const char *message, struct ucred *ucred, struct timeval *tv);



More information about the systemd-commits mailing list