Stopping services using glob patterns does not work as stated in man page (#1288851)
Resolves: #1288851
This commit is contained in:
parent
64a629fdb1
commit
b1b71981b2
193
0080-tests-don-t-abbreviate-function-names-needlessly.patch
Normal file
193
0080-tests-don-t-abbreviate-function-names-needlessly.patch
Normal file
@ -0,0 +1,193 @@
|
||||
From 202413f3d165af3535af0a307f15da392c8c0665 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Jan 2016 19:48:29 +0100
|
||||
Subject: [PATCH 1/6] tests: don't abbreviate function names needlessly
|
||||
|
||||
THis is otherwise really hard to read...
|
||||
|
||||
(cherry picked from commit 218685865a3a7457cb220d20b8f339618cd1d488)
|
||||
|
||||
Related: #1288851
|
||||
---
|
||||
src/test/test-unit-name.c | 112 +++++++++++++++++++++++-----------------------
|
||||
1 file changed, 56 insertions(+), 56 deletions(-)
|
||||
|
||||
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
|
||||
index e5405fb..399d519 100644
|
||||
--- a/src/test/test-unit-name.c
|
||||
+++ b/src/test/test-unit-name.c
|
||||
@@ -63,26 +63,26 @@ static void test_unit_name_is_valid(void) {
|
||||
assert_se(!unit_name_is_valid("@piep.service", UNIT_NAME_ANY));
|
||||
}
|
||||
|
||||
-static void test_u_n_r_i_one(const char *pattern, const char *repl, const char *expected, int ret) {
|
||||
+static void test_unit_name_replace_instance_one(const char *pattern, const char *repl, const char *expected, int ret) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
assert_se(unit_name_replace_instance(pattern, repl, &t) == ret);
|
||||
puts(strna(t));
|
||||
assert_se(streq_ptr(t, expected));
|
||||
}
|
||||
|
||||
-static void test_u_n_r_i(void) {
|
||||
+static void test_unit_name_replace_instance(void) {
|
||||
puts("-------------------------------------------------");
|
||||
- test_u_n_r_i_one("foo@.service", "waldo", "foo@waldo.service", 0);
|
||||
- test_u_n_r_i_one("foo@xyz.service", "waldo", "foo@waldo.service", 0);
|
||||
- test_u_n_r_i_one("xyz", "waldo", NULL, -EINVAL);
|
||||
- test_u_n_r_i_one("", "waldo", NULL, -EINVAL);
|
||||
- test_u_n_r_i_one("foo.service", "waldo", NULL, -EINVAL);
|
||||
- test_u_n_r_i_one(".service", "waldo", NULL, -EINVAL);
|
||||
- test_u_n_r_i_one("foo@", "waldo", NULL, -EINVAL);
|
||||
- test_u_n_r_i_one("@bar", "waldo", NULL, -EINVAL);
|
||||
+ test_unit_name_replace_instance_one("foo@.service", "waldo", "foo@waldo.service", 0);
|
||||
+ test_unit_name_replace_instance_one("foo@xyz.service", "waldo", "foo@waldo.service", 0);
|
||||
+ test_unit_name_replace_instance_one("xyz", "waldo", NULL, -EINVAL);
|
||||
+ test_unit_name_replace_instance_one("", "waldo", NULL, -EINVAL);
|
||||
+ test_unit_name_replace_instance_one("foo.service", "waldo", NULL, -EINVAL);
|
||||
+ test_unit_name_replace_instance_one(".service", "waldo", NULL, -EINVAL);
|
||||
+ test_unit_name_replace_instance_one("foo@", "waldo", NULL, -EINVAL);
|
||||
+ test_unit_name_replace_instance_one("@bar", "waldo", NULL, -EINVAL);
|
||||
}
|
||||
|
||||
-static void test_u_n_f_p_one(const char *path, const char *suffix, const char *expected, int ret) {
|
||||
+static void test_unit_name_from_path_one(const char *path, const char *suffix, const char *expected, int ret) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
assert_se(unit_name_from_path(path, suffix, &t) == ret);
|
||||
@@ -97,19 +97,19 @@ static void test_u_n_f_p_one(const char *path, const char *suffix, const char *e
|
||||
}
|
||||
}
|
||||
|
||||
-static void test_u_n_f_p(void) {
|
||||
+static void test_unit_name_from_path(void) {
|
||||
puts("-------------------------------------------------");
|
||||
- test_u_n_f_p_one("/waldo", ".mount", "waldo.mount", 0);
|
||||
- test_u_n_f_p_one("/waldo/quuix", ".mount", "waldo-quuix.mount", 0);
|
||||
- test_u_n_f_p_one("/waldo/quuix/", ".mount", "waldo-quuix.mount", 0);
|
||||
- test_u_n_f_p_one("", ".mount", "-.mount", 0);
|
||||
- test_u_n_f_p_one("/", ".mount", "-.mount", 0);
|
||||
- test_u_n_f_p_one("///", ".mount", "-.mount", 0);
|
||||
- test_u_n_f_p_one("/foo/../bar", ".mount", NULL, -EINVAL);
|
||||
- test_u_n_f_p_one("/foo/./bar", ".mount", NULL, -EINVAL);
|
||||
+ test_unit_name_from_path_one("/waldo", ".mount", "waldo.mount", 0);
|
||||
+ test_unit_name_from_path_one("/waldo/quuix", ".mount", "waldo-quuix.mount", 0);
|
||||
+ test_unit_name_from_path_one("/waldo/quuix/", ".mount", "waldo-quuix.mount", 0);
|
||||
+ test_unit_name_from_path_one("", ".mount", "-.mount", 0);
|
||||
+ test_unit_name_from_path_one("/", ".mount", "-.mount", 0);
|
||||
+ test_unit_name_from_path_one("///", ".mount", "-.mount", 0);
|
||||
+ test_unit_name_from_path_one("/foo/../bar", ".mount", NULL, -EINVAL);
|
||||
+ test_unit_name_from_path_one("/foo/./bar", ".mount", NULL, -EINVAL);
|
||||
}
|
||||
|
||||
-static void test_u_n_f_p_i_one(const char *pattern, const char *path, const char *suffix, const char *expected, int ret) {
|
||||
+static void test_unit_name_from_path_instance_one(const char *pattern, const char *path, const char *suffix, const char *expected, int ret) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
assert_se(unit_name_from_path_instance(pattern, path, suffix, &t) == ret);
|
||||
@@ -125,38 +125,38 @@ static void test_u_n_f_p_i_one(const char *pattern, const char *path, const char
|
||||
}
|
||||
}
|
||||
|
||||
-static void test_u_n_f_p_i(void) {
|
||||
+static void test_unit_name_from_path_instance(void) {
|
||||
puts("-------------------------------------------------");
|
||||
|
||||
- test_u_n_f_p_i_one("waldo", "/waldo", ".mount", "waldo@waldo.mount", 0);
|
||||
- test_u_n_f_p_i_one("waldo", "/waldo////quuix////", ".mount", "waldo@waldo-quuix.mount", 0);
|
||||
- test_u_n_f_p_i_one("waldo", "/", ".mount", "waldo@-.mount", 0);
|
||||
- test_u_n_f_p_i_one("waldo", "", ".mount", "waldo@-.mount", 0);
|
||||
- test_u_n_f_p_i_one("waldo", "///", ".mount", "waldo@-.mount", 0);
|
||||
- test_u_n_f_p_i_one("waldo", "..", ".mount", NULL, -EINVAL);
|
||||
- test_u_n_f_p_i_one("waldo", "/foo", ".waldi", NULL, -EINVAL);
|
||||
- test_u_n_f_p_i_one("wa--ldo", "/--", ".mount", "wa--ldo@\\x2d\\x2d.mount", 0);
|
||||
+ test_unit_name_from_path_instance_one("waldo", "/waldo", ".mount", "waldo@waldo.mount", 0);
|
||||
+ test_unit_name_from_path_instance_one("waldo", "/waldo////quuix////", ".mount", "waldo@waldo-quuix.mount", 0);
|
||||
+ test_unit_name_from_path_instance_one("waldo", "/", ".mount", "waldo@-.mount", 0);
|
||||
+ test_unit_name_from_path_instance_one("waldo", "", ".mount", "waldo@-.mount", 0);
|
||||
+ test_unit_name_from_path_instance_one("waldo", "///", ".mount", "waldo@-.mount", 0);
|
||||
+ test_unit_name_from_path_instance_one("waldo", "..", ".mount", NULL, -EINVAL);
|
||||
+ test_unit_name_from_path_instance_one("waldo", "/foo", ".waldi", NULL, -EINVAL);
|
||||
+ test_unit_name_from_path_instance_one("wa--ldo", "/--", ".mount", "wa--ldo@\\x2d\\x2d.mount", 0);
|
||||
}
|
||||
|
||||
-static void test_u_n_t_p_one(const char *unit, const char *path, int ret) {
|
||||
+static void test_unit_name_to_path_one(const char *unit, const char *path, int ret) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
assert_se(unit_name_to_path(unit, &p) == ret);
|
||||
assert_se(streq_ptr(path, p));
|
||||
}
|
||||
|
||||
-static void test_u_n_t_p(void) {
|
||||
- test_u_n_t_p_one("home.mount", "/home", 0);
|
||||
- test_u_n_t_p_one("home-lennart.mount", "/home/lennart", 0);
|
||||
- test_u_n_t_p_one("home-lennart-.mount", NULL, -EINVAL);
|
||||
- test_u_n_t_p_one("-home-lennart.mount", NULL, -EINVAL);
|
||||
- test_u_n_t_p_one("-home--lennart.mount", NULL, -EINVAL);
|
||||
- test_u_n_t_p_one("home-..-lennart.mount", NULL, -EINVAL);
|
||||
- test_u_n_t_p_one("", NULL, -EINVAL);
|
||||
- test_u_n_t_p_one("home/foo", NULL, -EINVAL);
|
||||
+static void test_unit_name_to_path(void) {
|
||||
+ test_unit_name_to_path_one("home.mount", "/home", 0);
|
||||
+ test_unit_name_to_path_one("home-lennart.mount", "/home/lennart", 0);
|
||||
+ test_unit_name_to_path_one("home-lennart-.mount", NULL, -EINVAL);
|
||||
+ test_unit_name_to_path_one("-home-lennart.mount", NULL, -EINVAL);
|
||||
+ test_unit_name_to_path_one("-home--lennart.mount", NULL, -EINVAL);
|
||||
+ test_unit_name_to_path_one("home-..-lennart.mount", NULL, -EINVAL);
|
||||
+ test_unit_name_to_path_one("", NULL, -EINVAL);
|
||||
+ test_unit_name_to_path_one("home/foo", NULL, -EINVAL);
|
||||
}
|
||||
|
||||
-static void test_u_n_m_one(const char *pattern, const char *expect, int ret) {
|
||||
+static void test_unit_name_mangle_one(const char *pattern, const char *expect, int ret) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
assert_se(unit_name_mangle(pattern, UNIT_NAME_NOGLOB, &t) == ret);
|
||||
@@ -173,17 +173,17 @@ static void test_u_n_m_one(const char *pattern, const char *expect, int ret) {
|
||||
}
|
||||
}
|
||||
|
||||
-static void test_u_n_m(void) {
|
||||
+static void test_unit_name_mangle(void) {
|
||||
puts("-------------------------------------------------");
|
||||
- test_u_n_m_one("foo.service", "foo.service", 0);
|
||||
- test_u_n_m_one("/home", "home.mount", 1);
|
||||
- test_u_n_m_one("/dev/sda", "dev-sda.device", 1);
|
||||
- test_u_n_m_one("üxknürz.service", "\\xc3\\xbcxkn\\xc3\\xbcrz.service", 1);
|
||||
- test_u_n_m_one("foobar-meh...waldi.service", "foobar-meh...waldi.service", 0);
|
||||
- test_u_n_m_one("_____####----.....service", "_____\\x23\\x23\\x23\\x23----.....service", 1);
|
||||
- test_u_n_m_one("_____##@;;;,,,##----.....service", "_____\\x23\\x23@\\x3b\\x3b\\x3b\\x2c\\x2c\\x2c\\x23\\x23----.....service", 1);
|
||||
- test_u_n_m_one("xxx@@@@/////\\\\\\\\\\yyy.service", "xxx@@@@-----\\\\\\\\\\yyy.service", 1);
|
||||
- test_u_n_m_one("", NULL, -EINVAL);
|
||||
+ test_unit_name_mangle_one("foo.service", "foo.service", 0);
|
||||
+ test_unit_name_mangle_one("/home", "home.mount", 1);
|
||||
+ test_unit_name_mangle_one("/dev/sda", "dev-sda.device", 1);
|
||||
+ test_unit_name_mangle_one("üxknürz.service", "\\xc3\\xbcxkn\\xc3\\xbcrz.service", 1);
|
||||
+ test_unit_name_mangle_one("foobar-meh...waldi.service", "foobar-meh...waldi.service", 0);
|
||||
+ test_unit_name_mangle_one("_____####----.....service", "_____\\x23\\x23\\x23\\x23----.....service", 1);
|
||||
+ test_unit_name_mangle_one("_____##@;;;,,,##----.....service", "_____\\x23\\x23@\\x3b\\x3b\\x3b\\x2c\\x2c\\x2c\\x23\\x23----.....service", 1);
|
||||
+ test_unit_name_mangle_one("xxx@@@@/////\\\\\\\\\\yyy.service", "xxx@@@@-----\\\\\\\\\\yyy.service", 1);
|
||||
+ test_unit_name_mangle_one("", NULL, -EINVAL);
|
||||
}
|
||||
|
||||
static int test_unit_printf(void) {
|
||||
@@ -459,11 +459,11 @@ static void test_unit_name_path_unescape(void) {
|
||||
int main(int argc, char* argv[]) {
|
||||
int rc = 0;
|
||||
test_unit_name_is_valid();
|
||||
- test_u_n_r_i();
|
||||
- test_u_n_f_p();
|
||||
- test_u_n_f_p_i();
|
||||
- test_u_n_m();
|
||||
- test_u_n_t_p();
|
||||
+ test_unit_name_replace_instance();
|
||||
+ test_unit_name_from_path();
|
||||
+ test_unit_name_from_path_instance();
|
||||
+ test_unit_name_mangle();
|
||||
+ test_unit_name_to_path();
|
||||
TEST_REQ_RUNNING_SYSTEMD(rc = test_unit_printf());
|
||||
test_unit_instance_is_valid();
|
||||
test_unit_prefix_is_valid();
|
||||
--
|
||||
2.5.0
|
||||
|
163
0081-basic-don-t-append-suffixes-to-unit-name-glob-expres.patch
Normal file
163
0081-basic-don-t-append-suffixes-to-unit-name-glob-expres.patch
Normal file
@ -0,0 +1,163 @@
|
||||
From 523abe6fb5160861889858319ccd97fba5bae9a7 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Jan 2016 20:25:10 +0100
|
||||
Subject: [PATCH 2/6] basic: don't append suffixes to unit name glob
|
||||
expressions
|
||||
|
||||
When the user specifies "foo*" as unit name glob expression, we shouldn't turn this into "foo*.service". Hence: only
|
||||
append a suffix if the specified string isn't a glob expression.
|
||||
|
||||
Fixes: #2397
|
||||
(cherry picked from commit 2aaafcf57048983b2b76d6325f333e50aca4a3a3)
|
||||
|
||||
Resolves: #1288851
|
||||
---
|
||||
src/basic/unit-name.c | 44 +++++++++++++++++++++++++++++++++-----------
|
||||
src/test/test-unit-name.c | 32 +++++++++++++++++++-------------
|
||||
2 files changed, 52 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c
|
||||
index bf52463..70db7a3 100644
|
||||
--- a/src/basic/unit-name.c
|
||||
+++ b/src/basic/unit-name.c
|
||||
@@ -29,10 +29,22 @@
|
||||
#include "def.h"
|
||||
#include "strv.h"
|
||||
|
||||
+/* Characters valid in a unit name. */
|
||||
#define VALID_CHARS \
|
||||
- DIGITS LETTERS \
|
||||
+ DIGITS \
|
||||
+ LETTERS \
|
||||
":-_.\\"
|
||||
|
||||
+/* The same, but also permits the single @ character that may appear */
|
||||
+#define VALID_CHARS_WITH_AT \
|
||||
+ "@" \
|
||||
+ VALID_CHARS
|
||||
+
|
||||
+/* All chars valid in a unit name glob */
|
||||
+#define VALID_CHARS_GLOB \
|
||||
+ VALID_CHARS_WITH_AT \
|
||||
+ "[]!-*?"
|
||||
+
|
||||
bool unit_name_is_valid(const char *n, UnitNameFlags flags) {
|
||||
const char *e, *i, *at;
|
||||
|
||||
@@ -596,7 +608,7 @@ static char *do_escape_mangle(const char *f, UnitNameMangle allow_globs, char *t
|
||||
/* We'll only escape the obvious characters here, to play
|
||||
* safe. */
|
||||
|
||||
- valid_chars = allow_globs == UNIT_NAME_GLOB ? "@" VALID_CHARS "[]!-*?" : "@" VALID_CHARS;
|
||||
+ valid_chars = allow_globs == UNIT_NAME_GLOB ? VALID_CHARS_GLOB : VALID_CHARS_WITH_AT;
|
||||
|
||||
for (; *f; f++) {
|
||||
if (*f == '/')
|
||||
@@ -631,15 +643,15 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, c
|
||||
if (!unit_suffix_is_valid(suffix))
|
||||
return -EINVAL;
|
||||
|
||||
- if (unit_name_is_valid(name, UNIT_NAME_ANY)) {
|
||||
- /* No mangling necessary... */
|
||||
- s = strdup(name);
|
||||
- if (!s)
|
||||
- return -ENOMEM;
|
||||
+ /* Already a fully valid unit name? If so, no mangling is necessary... */
|
||||
+ if (unit_name_is_valid(name, UNIT_NAME_ANY))
|
||||
+ goto good;
|
||||
|
||||
- *ret = s;
|
||||
- return 0;
|
||||
- }
|
||||
+ /* Already a fully valid globbing expression? If so, no mangling is necessary either... */
|
||||
+ if (allow_globs == UNIT_NAME_GLOB &&
|
||||
+ string_is_glob(name) &&
|
||||
+ in_charset(name, VALID_CHARS_GLOB))
|
||||
+ goto good;
|
||||
|
||||
if (is_device_path(name)) {
|
||||
r = unit_name_from_path(name, ".device", ret);
|
||||
@@ -664,11 +676,21 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, c
|
||||
t = do_escape_mangle(name, allow_globs, s);
|
||||
*t = 0;
|
||||
|
||||
- if (unit_name_to_type(s) < 0)
|
||||
+ /* Append a suffix if it doesn't have any, but only if this is not a glob, so that we can allow "foo.*" as a
|
||||
+ * valid glob. */
|
||||
+ if ((allow_globs != UNIT_NAME_GLOB || !string_is_glob(s)) && unit_name_to_type(s) < 0)
|
||||
strcpy(t, suffix);
|
||||
|
||||
*ret = s;
|
||||
return 1;
|
||||
+
|
||||
+good:
|
||||
+ s = strdup(name);
|
||||
+ if (!s)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ *ret = s;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
int slice_build_parent_slice(const char *slice, char **ret) {
|
||||
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
|
||||
index 399d519..31870ed 100644
|
||||
--- a/src/test/test-unit-name.c
|
||||
+++ b/src/test/test-unit-name.c
|
||||
@@ -156,34 +156,40 @@ static void test_unit_name_to_path(void) {
|
||||
test_unit_name_to_path_one("home/foo", NULL, -EINVAL);
|
||||
}
|
||||
|
||||
-static void test_unit_name_mangle_one(const char *pattern, const char *expect, int ret) {
|
||||
+static void test_unit_name_mangle_one(UnitNameMangle allow_globs, const char *pattern, const char *expect, int ret) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
- assert_se(unit_name_mangle(pattern, UNIT_NAME_NOGLOB, &t) == ret);
|
||||
+ assert_se(unit_name_mangle(pattern, allow_globs, &t) == ret);
|
||||
puts(strna(t));
|
||||
assert_se(streq_ptr(t, expect));
|
||||
|
||||
if (t) {
|
||||
_cleanup_free_ char *k = NULL;
|
||||
|
||||
- assert_se(unit_name_is_valid(t, UNIT_NAME_ANY));
|
||||
+ assert_se(unit_name_is_valid(t, UNIT_NAME_ANY) ||
|
||||
+ (allow_globs == UNIT_NAME_GLOB && string_is_glob(t)));
|
||||
|
||||
- assert_se(unit_name_mangle(t, UNIT_NAME_NOGLOB, &k) == 0);
|
||||
+ assert_se(unit_name_mangle(t, allow_globs, &k) == 0);
|
||||
assert_se(streq_ptr(t, k));
|
||||
}
|
||||
}
|
||||
|
||||
static void test_unit_name_mangle(void) {
|
||||
puts("-------------------------------------------------");
|
||||
- test_unit_name_mangle_one("foo.service", "foo.service", 0);
|
||||
- test_unit_name_mangle_one("/home", "home.mount", 1);
|
||||
- test_unit_name_mangle_one("/dev/sda", "dev-sda.device", 1);
|
||||
- test_unit_name_mangle_one("üxknürz.service", "\\xc3\\xbcxkn\\xc3\\xbcrz.service", 1);
|
||||
- test_unit_name_mangle_one("foobar-meh...waldi.service", "foobar-meh...waldi.service", 0);
|
||||
- test_unit_name_mangle_one("_____####----.....service", "_____\\x23\\x23\\x23\\x23----.....service", 1);
|
||||
- test_unit_name_mangle_one("_____##@;;;,,,##----.....service", "_____\\x23\\x23@\\x3b\\x3b\\x3b\\x2c\\x2c\\x2c\\x23\\x23----.....service", 1);
|
||||
- test_unit_name_mangle_one("xxx@@@@/////\\\\\\\\\\yyy.service", "xxx@@@@-----\\\\\\\\\\yyy.service", 1);
|
||||
- test_unit_name_mangle_one("", NULL, -EINVAL);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "foo.service", "foo.service", 0);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "/home", "home.mount", 1);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "/dev/sda", "dev-sda.device", 1);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "üxknürz.service", "\\xc3\\xbcxkn\\xc3\\xbcrz.service", 1);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "foobar-meh...waldi.service", "foobar-meh...waldi.service", 0);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "_____####----.....service", "_____\\x23\\x23\\x23\\x23----.....service", 1);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "_____##@;;;,,,##----.....service", "_____\\x23\\x23@\\x3b\\x3b\\x3b\\x2c\\x2c\\x2c\\x23\\x23----.....service", 1);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "xxx@@@@/////\\\\\\\\\\yyy.service", "xxx@@@@-----\\\\\\\\\\yyy.service", 1);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_NOGLOB, "", NULL, -EINVAL);
|
||||
+
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo.service", "foo.service", 0);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo", "foo.service", 1);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo*", "foo*", 0);
|
||||
+ test_unit_name_mangle_one(UNIT_NAME_GLOB, "ü*", "\\xc3\\xbc*", 1);
|
||||
}
|
||||
|
||||
static int test_unit_printf(void) {
|
||||
--
|
||||
2.5.0
|
||||
|
@ -0,0 +1,72 @@
|
||||
From ea7a3a783f8c9f49f5aedae9574fd70d9c9074ec Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Jan 2016 19:50:04 +0100
|
||||
Subject: [PATCH 3/6] man: document that unit file globbing only operates on
|
||||
primary unit names
|
||||
|
||||
See: #2397
|
||||
(cherry picked from commit 1f00ededc7451933e23a95597804897b37fa88d6)
|
||||
|
||||
Related: #1288851
|
||||
---
|
||||
man/systemctl.xml | 27 ++++++++++++---------------
|
||||
1 file changed, 12 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/man/systemctl.xml b/man/systemctl.xml
|
||||
index 66a0900..50e8ce0 100644
|
||||
--- a/man/systemctl.xml
|
||||
+++ b/man/systemctl.xml
|
||||
@@ -658,14 +658,11 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||
<para>Start (activate) one or more units specified on the
|
||||
command line.</para>
|
||||
|
||||
- <para>Note that glob patterns operate on a list of currently
|
||||
- loaded units. Units which are not active and are not in a
|
||||
- failed state usually are not loaded, and would not be
|
||||
- matched by any pattern. In addition, in case of
|
||||
- instantiated units, systemd is often unaware of the
|
||||
- instance name until the instance has been started. Therefore,
|
||||
- using glob patterns with <command>start</command>
|
||||
- has limited usefulness.</para>
|
||||
+ <para>Note that glob patterns operate on the set of primary names of currently loaded units. Units which
|
||||
+ are not active and are not in a failed state usually are not loaded, and will not be matched by any
|
||||
+ pattern. In addition, in case of instantiated units, systemd is often unaware of the instance name until
|
||||
+ the instance has been started. Therefore, using glob patterns with <command>start</command> has limited
|
||||
+ usefulness. Also, secondary alias names of units are not considered.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -1701,11 +1698,10 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||
are equivalent to:
|
||||
<programlisting># systemctl status dev-sda.device
|
||||
# systemctl status home.mount</programlisting>
|
||||
- In the second case, shell-style globs will be matched against
|
||||
- currently loaded units; literal unit names, with or without
|
||||
- a suffix, will be treated as in the first case. This means that
|
||||
- literal unit names always refer to exactly one unit, but globs
|
||||
- may match zero units and this is not considered an error.</para>
|
||||
+ In the second case, shell-style globs will be matched against the primary names of all currently loaded units;
|
||||
+ literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit
|
||||
+ names always refer to exactly one unit, but globs may match zero units and this is not considered an
|
||||
+ error.</para>
|
||||
|
||||
<para>Glob patterns use
|
||||
<citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
@@ -1713,11 +1709,12 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||
<literal>*</literal>, <literal>?</literal>,
|
||||
<literal>[]</literal> may be used. See
|
||||
<citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
|
||||
- for more details. The patterns are matched against the names of
|
||||
+ for more details. The patterns are matched against the primary names of
|
||||
currently loaded units, and patterns which do not match anything
|
||||
are silently skipped. For example:
|
||||
<programlisting># systemctl stop sshd@*.service</programlisting>
|
||||
- will stop all <filename>sshd@.service</filename> instances.
|
||||
+ will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't
|
||||
+ loaded are not considered for glob expansion.
|
||||
</para>
|
||||
|
||||
<para>For unit file commands, the specified
|
||||
--
|
||||
2.5.0
|
||||
|
@ -13,7 +13,7 @@
|
||||
Name: systemd
|
||||
Url: http://www.freedesktop.org/wiki/Software/systemd
|
||||
Version: 222
|
||||
Release: 13%{?gitcommit:.git%{gitcommit}}%{?dist}
|
||||
Release: 14%{?gitcommit:.git%{gitcommit}}%{?dist}
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: A System and Service Manager
|
||||
@ -112,6 +112,9 @@ Patch0076: 0076-core-do-not-warn-about-Wants-depencencies-on-masked-.patch
|
||||
Patch0077: 0077-transaction-downgrade-warnings-about-wanted-unit-whi.patch
|
||||
Patch0078: 0078-hwdb-add-axis-ranges-and-resolution-for-Dell-Lattitu.patch
|
||||
Patch0079: 0079-machined-rework-state-tracking-logic-for-machines.patch
|
||||
Patch0080: 0080-tests-don-t-abbreviate-function-names-needlessly.patch
|
||||
Patch0081: 0081-basic-don-t-append-suffixes-to-unit-name-glob-expres.patch
|
||||
Patch0082: 0082-man-document-that-unit-file-globbing-only-operates-o.patch
|
||||
|
||||
Patch997: 0001-Re-apply-walters-unit-patch-for-F23-systemd-v222.patch
|
||||
Patch998: 0001-Revert-core-mount-add-dependencies-to-dynamically-mo-v222.patch
|
||||
@ -852,6 +855,9 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
|
||||
/usr/lib/firewalld/services/*
|
||||
|
||||
%changelog
|
||||
* Mon Feb 1 2016 Jan Synáček <jsynacek@redhat.com> - 222-14
|
||||
- Stopping services using glob patterns does not work as stated in man page (#1288851)
|
||||
|
||||
* Mon Jan 25 2016 Jan Synáček <jsynacek@redhat.com> - 222-13
|
||||
- units: increase watchdog timeout to 3min for all our services
|
||||
+ Mitigates the problem described in #1300212.
|
||||
|
Loading…
Reference in New Issue
Block a user