From 37cbc1d57992f49b3607bd66973dd30e0a8d1073 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 21 Mar 2018 15:26:47 +0100 Subject: When mangling names, optionally emit a warning (#8400) The warning is not emitted for absolute paths like /dev/sda or /home, which are converted to .device and .mount unit names without any fuss. Most of the time it's unlikely that users use invalid unit names on purpose, so let's warn them. Warnings are silenced when --quiet is used. $ build/systemctl show -p Id hello@foo-bar/baz Invalid unit name "hello@foo-bar/baz" was escaped as "hello@foo-bar-baz" (maybe you should use systemd-escape?) Id=hello@foo-bar-baz.service $ build/systemd-run --user --slice foo-bar/baz --unit foo-bar/foo true Invalid unit name "foo-bar/foo" was escaped as "foo-bar-foo" (maybe you should use systemd-escape?) Invalid unit name "foo-bar/baz" was escaped as "foo-bar-baz" (maybe you should use systemd-escape?) Running as unit: foo-bar-foo.service Fixes #8302. --- src/escape/escape.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/escape') diff --git a/src/escape/escape.c b/src/escape/escape.c index 9c35b4663e..2eb0a58673 100644 --- a/src/escape/escape.c +++ b/src/escape/escape.c @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) { break; case ACTION_MANGLE: - r = unit_name_mangle(*i, UNIT_NAME_NOGLOB, &e); + r = unit_name_mangle(*i, 0, &e); if (r < 0) { log_error_errno(r, "Failed to mangle name: %m"); goto finish; -- cgit v1.2.3