|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 8e07fc41f86d41e68c5663b2a3c620a0adedcc11 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Sun, 31 Aug 2014 00:42:27 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] Quote unit names in suggested systemctl commandlines
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
The fact that unit names have to be quoted can be a bit surprising.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Show quotes in the hint commandline, but only after checking that this
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
is necessary, since quotes are visually heavy and usually not needed.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
https://bugs.freedesktop.org/show_bug.cgi?id=82832
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/core/job.c | 11 +++++++++--
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/systemctl/systemctl.c | 14 ++++++++++++--
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
2 files changed, 21 insertions(+), 4 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/core/job.c b/src/core/job.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 5e4987f4e2..ef5dbce1a3 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/core/job.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/core/job.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -632,11 +632,18 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unit_status_printf(u, ANSI_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, format);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- case JOB_FAILED:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ case JOB_FAILED: {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ bool quotes;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ quotes = chars_intersect(u->id, SHELL_NEED_QUOTES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
manager_flip_auto_status(u->manager, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- manager_status_printf(u->manager, false, NULL, "See 'systemctl status %s' for details.", u->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ manager_status_printf(u->manager, false, NULL,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ "See \"systemctl status %s%s%s\" for details.",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ quotes ? "'" : "", u->id, quotes ? "'" : "");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case JOB_DEPENDENCY:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
manager_flip_auto_status(u->manager, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 65348193b7..de43c879a7 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2351,8 +2351,18 @@ static int check_wait_response(WaitData *d) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
log_error("Job for %s canceled.", strna(d->name));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
else if (streq(d->result, "dependency"))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
log_error("A dependency job for %s failed. See 'journalctl -xn' for details.", strna(d->name));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- else if (!streq(d->result, "done") && !streq(d->result, "skipped"))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_error("Job for %s failed. See 'systemctl status %s' and 'journalctl -xn' for details.", strna(d->name), strna(d->name));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ else if (!streq(d->result, "done") && !streq(d->result, "skipped")) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (d->name) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ bool quotes;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ quotes = chars_intersect(d->name, SHELL_NEED_QUOTES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error("Job for %s failed. See \"systemctl status %s%s%s\" and \"journalctl -xn\" for details.",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ d->name,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ quotes ? "'" : "", d->name, quotes ? "'" : "");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ } else
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error("Job failed. See \"journalctl -xn\" for details.");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (streq(d->result, "timeout"))
|