hostnamectl: fix hyperlink in "Operating System" field
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 4 May 2021 09:00:12 +0000 (18:00 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 6 May 2021 11:11:27 +0000 (13:11 +0200)
This fixes a bug introduced by 822be62fb23ed0ec1062ffd18057e53f6c2f8c01.

Before this, if terminal width is not enough, the all subsequent lines
are included in the hyperlink.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1955475.

(cherry picked from commit 8fc1efa88fb935ab4357fa39ed71ccb70df55d7e)

src/hostname/hostnamectl.c

index e7cb015ef2dc71559187791e495e78a7f4905925..706259eac89565437007ba1d61cbe1fd3fe77261 100644 (file)
@@ -155,17 +155,10 @@ static int print_status_info(StatusInfo *i) {
         }
 
         if (!isempty(i->os_pretty_name)) {
-                _cleanup_free_ char *formatted = NULL;
-                const char *t = i->os_pretty_name;
-
-                if (i->home_url) {
-                        if (terminal_urlify(i->home_url, i->os_pretty_name, &formatted) >= 0)
-                                t = formatted;
-                }
-
                 r = table_add_many(table,
                                    TABLE_STRING, "Operating System:",
-                                   TABLE_STRING, t);
+                                   TABLE_STRING, i->os_pretty_name,
+                                   TABLE_SET_URL, i->home_url);
                 if (r < 0)
                         return table_log_add_error(r);
         }