[systemd-commits] 3 commits - src/journal src/shared src/systemctl TODO

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Sun Aug 11 15:11:20 PDT 2013


 TODO                           |    4 +
 src/journal/journal-gatewayd.c |    2 
 src/journal/journalctl.c       |    3 -
 src/shared/logs-show.c         |  104 ++++++++++++++++++++++++++++++-----------
 src/shared/logs-show.h         |    6 +-
 src/shared/util.c              |    2 
 src/systemctl/systemctl.c      |   97 ++++++++++++++++++++++----------------
 7 files changed, 147 insertions(+), 71 deletions(-)

New commits:
commit a6f0104a16350a4c2660837da6e0e5c2e50e2389
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sun Aug 11 10:56:09 2013 -0400

    logs-show: limit to 3 lines and use dots if not showing full message
    
    So far, we would show up to 128 bytes from a message, simply
    cutting of the rest. With multiline messages, it is quite common
    for a message to be longer than that, and this model doesn't really
    work anymore.
    
    A new limit is added: up to 3 lines will be shown, unless --full is
    used (c.f. first line below).  The limit for bytes is extended to 300
    bytes. An ellipsis will always be used, if some form of truncation
    occurs. If the tail of the message is cut off, either because of
    length or line limit, dots will be shown at the end of the last
    line. If this last line is short, the dots will be simply appended. If
    the last line is too long for that, it will be ellipsized with dots at
    the very end.
    
    Note that the limits are in bytes, not characters, and we suck at
    outputting unicode strings (c.f. last three lines below).
    
    Aug 11 10:46:21 fedora python[67]: test message
                                       line
                                       line...
    Aug 11 10:50:47 fedora python[76]: test message word word word word word word word word word word word wor...
    Aug 11 10:55:11 fedora python[83]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
    Aug 11 11:03:21 fedora python[90]: Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…...
    Aug 11 11:03:53 fedora python[97]: aÄ…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…Ä…...
    Aug 11 11:25:45 fedora python[121]: aąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąą�...

diff --git a/TODO b/TODO
index 438b644..d72a65d 100644
--- a/TODO
+++ b/TODO
@@ -19,6 +19,10 @@ Bugfixes:
 
 * properly handle .mount unit state tracking when two mount points are stacked one on top of another on the exact same mount point.
 
+* ellipsize_mem must take into account multi-byte unicode characters, and
+  - make the resulting line the requested number of *characters*, not *bytes*,
+  - avoid truncuating multi-byte sequences in the middle.
+
 Fedora 20:
 
 * external: ps should gain colums for slice and machine
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 2270c3b..af738a3 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -32,7 +32,11 @@
 #include "hashmap.h"
 #include "journal-internal.h"
 
-#define PRINT_THRESHOLD 128
+/* up to three lines (each up to 100 characters),
+   or 300 characters, whichever is less */
+#define PRINT_LINE_THRESHOLD 3
+#define PRINT_CHAR_THRESHOLD 300
+
 #define JSON_THRESHOLD 4096
 
 static int print_catalog(FILE *f, sd_journal *j) {
@@ -92,7 +96,7 @@ static bool shall_print(const char *p, size_t l, OutputFlags flags) {
         if (flags & OUTPUT_SHOW_ALL)
                 return true;
 
-        if (l >= PRINT_THRESHOLD)
+        if (l >= PRINT_CHAR_THRESHOLD)
                 return false;
 
         if (!utf8_is_printable(p, l))
@@ -104,8 +108,8 @@ static bool shall_print(const char *p, size_t l, OutputFlags flags) {
 static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, OutputMode flags, int priority, const char* message, size_t message_len) {
         const char *color_on = "", *color_off = "";
         const char *pos, *end;
-        bool continuation = false;
         bool ellipsized = false;
+        int line = 0;
 
         if (flags & OUTPUT_COLOR) {
                 if (priority <= LOG_ERR) {
@@ -117,37 +121,61 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
                 }
         }
 
-        for (pos = message; pos < message + message_len; pos = end + 1) {
+        for (pos = message;
+             pos < message + message_len;
+             pos = end + 1, line++) {
+                bool continuation = line > 0;
+                bool tail_line;
                 int len;
                 for (end = pos; end < message + message_len && *end != '\n'; end++)
                         ;
                 len = end - pos;
                 assert(len >= 0);
 
-                if (flags & (OUTPUT_FULL_WIDTH | OUTPUT_SHOW_ALL) || prefix + len + 1 < n_columns)
+                /* We need to figure out when we are showing the last line, and
+                 * will skip subsequent lines. In that case, we will put the dots
+                 * at the end of the line, instead of putting dots in the middle
+                 * or not at all.
+                 */
+                tail_line =
+                        line + 1 == PRINT_LINE_THRESHOLD ||
+                        end + 1 >= message + message_len;
+
+                if (flags & (OUTPUT_FULL_WIDTH | OUTPUT_SHOW_ALL) ||
+                    (prefix + len + 1 < n_columns && !tail_line)) {
                         fprintf(f, "%*s%s%.*s%s\n",
                                 continuation * prefix, "",
                                 color_on, len, pos, color_off);
-                else if (prefix < n_columns && n_columns - prefix >= 3) {
-                        _cleanup_free_ char *e;
+                        continue;
+                }
 
-                        ellipsized = true;
-                        e = ellipsize_mem(pos, len, n_columns - prefix, 90);
+                /* Beyond this point, ellipsization will happen. */
+                ellipsized = true;
 
-                        if (!e)
-                                fprintf(f, "%*s%s%.*s%s\n",
+                if (prefix < n_columns && n_columns - prefix >= 3) {
+                        if (n_columns - prefix > (unsigned) len + 3)
+                                fprintf(f, "%*s%s%.*s...%s\n",
                                         continuation * prefix, "",
                                         color_on, len, pos, color_off);
-                        else
-                                fprintf(f, "%*s%s%s%s\n",
-                                        continuation * prefix, "",
-                                        color_on, e, color_off);
-                } else {
-                        ellipsized = true;
+                        else {
+                                _cleanup_free_ char *e;
+
+                                e = ellipsize_mem(pos, len, n_columns - prefix,
+                                                  tail_line ? 100 : 90);
+                                if (!e)
+                                        fprintf(f, "%*s%s%.*s%s\n",
+                                                continuation * prefix, "",
+                                                color_on, len, pos, color_off);
+                                else
+                                        fprintf(f, "%*s%s%s%s\n",
+                                                continuation * prefix, "",
+                                                color_on, e, color_off);
+                        }
+                } else
                         fputs("...\n", f);
-                }
 
-                continuation = true;
+                if (tail_line)
+                        break;
         }
 
         return ellipsized;
@@ -172,7 +200,13 @@ static int output_short(
         assert(f);
         assert(j);
 
-        sd_journal_set_data_threshold(j, flags & (OUTPUT_SHOW_ALL|OUTPUT_FULL_WIDTH) ? 0 : PRINT_THRESHOLD);
+        /* Set the threshold to one bigger than the actual print
+         * treshold, so that if the line is actually longer than what
+         * we're willing to print, ellipsization will occur. This way
+         * we won't output a misleading line without any indication of
+         * truncation.
+         */
+        sd_journal_set_data_threshold(j, flags & (OUTPUT_SHOW_ALL|OUTPUT_FULL_WIDTH) ? 0 : PRINT_CHAR_THRESHOLD + 1);
 
         JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
 
@@ -389,7 +423,8 @@ static int output_verbose(
                 }
 
                 if (flags & OUTPUT_SHOW_ALL ||
-                    (((length < PRINT_THRESHOLD) || flags & OUTPUT_FULL_WIDTH) && utf8_is_printable(data, length))) {
+                    (((length < PRINT_CHAR_THRESHOLD) || flags & OUTPUT_FULL_WIDTH)
+                     && utf8_is_printable(data, length))) {
                         fprintf(f, "    %s%.*s=", on, fieldlen, (const char*)data);
                         print_multiline(f, 4 + fieldlen + 1, 0, OUTPUT_FULL_WIDTH, 0, c + 1, length - fieldlen - 1);
                         fputs(off, f);
diff --git a/src/shared/util.c b/src/shared/util.c
index c8ed53c..f23dd92 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3332,7 +3332,7 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
 
         r = new0(char, new_length+1);
         if (!r)
-                return r;
+                return NULL;
 
         x = (new_length * percent) / 100;
 

commit b4b02cbeec04b51697bce1f4e439b9b7afae5393
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 8 08:32:43 2013 -0400

    logs-show: fix indentation for 2nd and later lines, show lines in full
    
    Now --full will show long fields in full, like it already did
    with --all.

diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 51cd7d5..2270c3b 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -135,9 +135,13 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
                         e = ellipsize_mem(pos, len, n_columns - prefix, 90);
 
                         if (!e)
-                                fprintf(f, "%s%.*s%s\n", color_on, len, pos, color_off);
+                                fprintf(f, "%*s%s%.*s%s\n",
+                                        continuation * prefix, "",
+                                        color_on, len, pos, color_off);
                         else
-                                fprintf(f, "%s%s%s\n", color_on, e, color_off);
+                                fprintf(f, "%*s%s%s%s\n",
+                                        continuation * prefix, "",
+                                        color_on, e, color_off);
                 } else {
                         ellipsized = true;
                         fputs("...\n", f);
@@ -168,7 +172,7 @@ static int output_short(
         assert(f);
         assert(j);
 
-        sd_journal_set_data_threshold(j, flags & OUTPUT_SHOW_ALL ? 0 : PRINT_THRESHOLD);
+        sd_journal_set_data_threshold(j, flags & (OUTPUT_SHOW_ALL|OUTPUT_FULL_WIDTH) ? 0 : PRINT_THRESHOLD);
 
         JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
 

commit 94e0bd7db1d7ca8ab7f738cdab1d014241f5b225
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Aug 3 19:38:13 2013 -0400

    systemctl: show hint about --full when lines don't fit

diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c
index 10224a1..06a236d 100644
--- a/src/journal/journal-gatewayd.c
+++ b/src/journal/journal-gatewayd.c
@@ -248,7 +248,7 @@ static ssize_t request_reader_entries(
                         }
                 }
 
-                r = output_journal(m->tmp, m->journal, m->mode, 0, OUTPUT_FULL_WIDTH);
+                r = output_journal(m->tmp, m->journal, m->mode, 0, OUTPUT_FULL_WIDTH, NULL);
                 if (r < 0) {
                         log_error("Failed to serialize item: %s", strerror(-r));
                         return MHD_CONTENT_READER_END_WITH_ERROR;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index feea6bf..5cf9390 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1305,6 +1305,7 @@ int main(int argc, char *argv[]) {
         sd_id128_t previous_boot_id;
         bool previous_boot_id_valid = false, first_line = true;
         int n_shown = 0;
+        bool ellipsized = false;
 
         setlocale(LC_ALL, "");
         log_parse_environment();
@@ -1624,7 +1625,7 @@ int main(int argc, char *argv[]) {
                                 on_tty() * OUTPUT_COLOR |
                                 arg_catalog * OUTPUT_CATALOG;
 
-                        r = output_journal(stdout, j, arg_output, 0, flags);
+                        r = output_journal(stdout, j, arg_output, 0, flags, &ellipsized);
                         need_seek = true;
                         if (r == -EADDRNOTAVAIL)
                                 break;
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index bd7363a..51cd7d5 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -101,10 +101,11 @@ static bool shall_print(const char *p, size_t l, OutputFlags flags) {
         return true;
 }
 
-static void print_multiline(FILE *f, unsigned prefix, unsigned n_columns, OutputMode flags, int priority, const char* message, size_t message_len) {
+static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, OutputMode flags, int priority, const char* message, size_t message_len) {
         const char *color_on = "", *color_off = "";
         const char *pos, *end;
         bool continuation = false;
+        bool ellipsized = false;
 
         if (flags & OUTPUT_COLOR) {
                 if (priority <= LOG_ERR) {
@@ -130,17 +131,22 @@ static void print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
                 else if (prefix < n_columns && n_columns - prefix >= 3) {
                         _cleanup_free_ char *e;
 
+                        ellipsized = true;
                         e = ellipsize_mem(pos, len, n_columns - prefix, 90);
 
                         if (!e)
                                 fprintf(f, "%s%.*s%s\n", color_on, len, pos, color_off);
                         else
                                 fprintf(f, "%s%s%s\n", color_on, e, color_off);
-                } else
+                } else {
+                        ellipsized = true;
                         fputs("...\n", f);
+                }
 
                 continuation = true;
         }
+
+        return ellipsized;
 }
 
 static int output_short(
@@ -157,6 +163,7 @@ static int output_short(
         _cleanup_free_ char *hostname = NULL, *identifier = NULL, *comm = NULL, *pid = NULL, *fake_pid = NULL, *message = NULL, *realtime = NULL, *monotonic = NULL, *priority = NULL;
         size_t hostname_len = 0, identifier_len = 0, comm_len = 0, pid_len = 0, fake_pid_len = 0, message_len = 0, realtime_len = 0, monotonic_len = 0, priority_len = 0;
         int p = LOG_INFO;
+        bool ellipsized = false;
 
         assert(f);
         assert(j);
@@ -314,13 +321,14 @@ static int output_short(
                 fprintf(f, ": [%s blob data]\n", format_bytes(bytes, sizeof(bytes), message_len));
         } else {
                 fputs(": ", f);
-                print_multiline(f, n + 2, n_columns, flags, p, message, message_len);
+                ellipsized |=
+                        print_multiline(f, n + 2, n_columns, flags, p, message, message_len);
         }
 
         if (flags & OUTPUT_CATALOG)
                 print_catalog(f, j);
 
-        return 0;
+        return ellipsized;
 }
 
 static int output_verbose(
@@ -817,7 +825,8 @@ int output_journal(
                 sd_journal *j,
                 OutputMode mode,
                 unsigned n_columns,
-                OutputFlags flags) {
+                OutputFlags flags,
+                bool *ellipsized) {
 
         int ret;
         assert(mode >= 0);
@@ -828,6 +837,10 @@ int output_journal(
 
         ret = output_funcs[mode](f, j, mode, n_columns, flags);
         fflush(stdout);
+
+        if (ellipsized && ret > 0)
+                *ellipsized = true;
+
         return ret;
 }
 
@@ -837,7 +850,8 @@ static int show_journal(FILE *f,
                         unsigned n_columns,
                         usec_t not_before,
                         unsigned how_many,
-                        OutputFlags flags) {
+                        OutputFlags flags,
+                        bool *ellipsized) {
 
         int r;
         unsigned line = 0;
@@ -888,7 +902,7 @@ static int show_journal(FILE *f,
 
                         line ++;
 
-                        r = output_journal(f, j, mode, n_columns, flags);
+                        r = output_journal(f, j, mode, n_columns, flags, ellipsized);
                         if (r < 0)
                                 goto finish;
                 }
@@ -1037,7 +1051,8 @@ int show_journal_by_unit(
                 unsigned how_many,
                 uid_t uid,
                 OutputFlags flags,
-                bool system) {
+                bool system,
+                bool *ellipsized) {
 
         _cleanup_journal_close_ sd_journal*j = NULL;
         int r;
@@ -1072,11 +1087,7 @@ int show_journal_by_unit(
                 log_debug("Journal filter: %s", filter);
         }
 
-        r = show_journal(f, j, mode, n_columns, not_before, how_many, flags);
-        if (r < 0)
-                return r;
-
-        return 0;
+        return show_journal(f, j, mode, n_columns, not_before, how_many, flags, ellipsized);
 }
 
 static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {
diff --git a/src/shared/logs-show.h b/src/shared/logs-show.h
index c9a9ad3..11b3b59 100644
--- a/src/shared/logs-show.h
+++ b/src/shared/logs-show.h
@@ -35,7 +35,8 @@ int output_journal(
                 sd_journal *j,
                 OutputMode mode,
                 unsigned n_columns,
-                OutputFlags flags);
+                OutputFlags flags,
+                bool *ellipsized);
 
 int add_match_this_boot(sd_journal *j);
 
@@ -57,7 +58,8 @@ int show_journal_by_unit(
                 unsigned how_many,
                 uid_t uid,
                 OutputFlags flags,
-                bool system);
+                bool system,
+                bool *ellipsized);
 
 void json_escape(
                 FILE *f,
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3dd74c2..a635891 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2503,7 +2503,8 @@ typedef struct UnitStatusInfo {
         LIST_HEAD(ExecStatusInfo, exec);
 } UnitStatusInfo;
 
-static void print_status_info(UnitStatusInfo *i) {
+static void print_status_info(UnitStatusInfo *i,
+                              bool *ellipsized) {
         ExecStatusInfo *p;
         const char *on, *off, *ss;
         usec_t timestamp;
@@ -2779,7 +2780,8 @@ static void print_status_info(UnitStatusInfo *i) {
                                      arg_lines,
                                      getuid(),
                                      flags,
-                                     arg_scope == UNIT_FILE_SYSTEM);
+                                     arg_scope == UNIT_FILE_SYSTEM,
+                                     ellipsized);
         }
 
         if (i->need_daemon_reload)
@@ -3345,7 +3347,12 @@ static int print_property(const char *name, DBusMessageIter *iter) {
         return 0;
 }
 
-static int show_one(const char *verb, DBusConnection *bus, const char *path, bool show_properties, bool *new_line) {
+static int show_one(const char *verb,
+                    DBusConnection *bus,
+                    const char *path,
+                    bool show_properties,
+                    bool *new_line,
+                    bool *ellipsized) {
         _cleanup_free_ DBusMessage *reply = NULL;
         const char *interface = "";
         int r;
@@ -3415,7 +3422,7 @@ static int show_one(const char *verb, DBusConnection *bus, const char *path, boo
                 if (streq(verb, "help"))
                         show_unit_help(&info);
                 else
-                        print_status_info(&info);
+                        print_status_info(&info, ellipsized);
         }
 
         strv_free(info.documentation);
@@ -3446,7 +3453,11 @@ static int show_one(const char *verb, DBusConnection *bus, const char *path, boo
         return r;
 }
 
-static int show_one_by_pid(const char *verb, DBusConnection *bus, uint32_t pid, bool *new_line) {
+static int show_one_by_pid(const char *verb,
+                           DBusConnection *bus,
+                           uint32_t pid,
+                           bool *new_line,
+                           bool *ellipsized) {
         _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
         const char *path = NULL;
         _cleanup_dbus_error_free_ DBusError error;
@@ -3474,11 +3485,15 @@ static int show_one_by_pid(const char *verb, DBusConnection *bus, uint32_t pid,
                 return -EIO;
         }
 
-        r = show_one(verb, bus, path, false, new_line);
+        r = show_one(verb, bus, path, false, new_line, ellipsized);
         return r;
 }
 
-static int show_all(const char* verb, DBusConnection *bus, bool show_properties, bool *new_line) {
+static int show_all(const char* verb,
+                    DBusConnection *bus,
+                    bool show_properties,
+                    bool *new_line,
+                    bool *ellipsized) {
         _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
         _cleanup_free_ struct unit_info *unit_infos = NULL;
         unsigned c = 0;
@@ -3503,7 +3518,7 @@ static int show_all(const char* verb, DBusConnection *bus, bool show_properties,
 
                 printf("%s -> '%s'\n", u->id, p);
 
-                r = show_one(verb, bus, p, show_properties, new_line);
+                r = show_one(verb, bus, p, show_properties, new_line, ellipsized);
                 if (r != 0)
                         return r;
         }
@@ -3515,6 +3530,7 @@ static int show(DBusConnection *bus, char **args) {
         int r, ret = 0;
         bool show_properties, show_status, new_line = false;
         char **name;
+        bool ellipsized = false;
 
         assert(bus);
         assert(args);
@@ -3528,48 +3544,51 @@ static int show(DBusConnection *bus, char **args) {
         /* If no argument is specified inspect the manager itself */
 
         if (show_properties && strv_length(args) <= 1)
-                return show_one(args[0], bus, "/org/freedesktop/systemd1", show_properties, &new_line);
+                return show_one(args[0], bus, "/org/freedesktop/systemd1", show_properties, &new_line, &ellipsized);
 
         if (show_status && strv_length(args) <= 1)
-                return show_all(args[0], bus, false, &new_line);
-
-        STRV_FOREACH(name, args+1) {
-                uint32_t id;
+                ret = show_all(args[0], bus, false, &new_line, &ellipsized);
+        else
+                STRV_FOREACH(name, args+1) {
+                        uint32_t id;
 
-                if (safe_atou32(*name, &id) < 0) {
-                        _cleanup_free_ char *p = NULL, *n = NULL;
-                        /* Interpret as unit name */
+                        if (safe_atou32(*name, &id) < 0) {
+                                _cleanup_free_ char *p = NULL, *n = NULL;
+                                /* Interpret as unit name */
 
-                        n = unit_name_mangle(*name);
-                        if (!n)
-                                return log_oom();
+                                n = unit_name_mangle(*name);
+                                if (!n)
+                                        return log_oom();
 
-                        p = unit_dbus_path_from_name(n);
-                        if (!p)
-                                return log_oom();
+                                p = unit_dbus_path_from_name(n);
+                                if (!p)
+                                        return log_oom();
 
-                        r = show_one(args[0], bus, p, show_properties, &new_line);
-                        if (r != 0)
-                                ret = r;
+                                r = show_one(args[0], bus, p, show_properties, &new_line, &ellipsized);
+                                if (r != 0)
+                                        ret = r;
 
-                } else if (show_properties) {
-                        _cleanup_free_ char *p = NULL;
+                        } else if (show_properties) {
+                                _cleanup_free_ char *p = NULL;
 
-                        /* Interpret as job id */
-                        if (asprintf(&p, "/org/freedesktop/systemd1/job/%u", id) < 0)
-                                return log_oom();
+                                /* Interpret as job id */
+                                if (asprintf(&p, "/org/freedesktop/systemd1/job/%u", id) < 0)
+                                        return log_oom();
 
-                        r = show_one(args[0], bus, p, show_properties, &new_line);
-                        if (r != 0)
-                                ret = r;
+                                r = show_one(args[0], bus, p, show_properties, &new_line, &ellipsized);
+                                if (r != 0)
+                                        ret = r;
 
-                } else {
-                        /* Interpret as PID */
-                        r = show_one_by_pid(args[0], bus, id, &new_line);
-                        if (r != 0)
-                                ret = r;
+                        } else {
+                                /* Interpret as PID */
+                                r = show_one_by_pid(args[0], bus, id, &new_line, &ellipsized);
+                                if (r != 0)
+                                        ret = r;
+                        }
                 }
-        }
+
+        if (ellipsized && !arg_quiet)
+                printf("Hint: Some lines were ellipsized, use -l to show in full.\n");
 
         return ret;
 }



More information about the systemd-commits mailing list