diff options
3 files changed, 0 insertions, 174 deletions
diff --git a/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch b/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch deleted file mode 100644 index cd4dcad16..000000000 --- a/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 899173e241f781ad4dfb6b40e7c5f35104164435 Mon Sep 17 00:00:00 2001 -From: Brad Bishop <bradleyb@fuzziesquirrel.com> -Date: Thu, 12 Jan 2017 09:56:54 -0500 -Subject: [PATCH 1/2] basic: Factor out string checking from - name_to_prefix/instance - -Add two new functions: string_to_prefix/instance that enable -prefix/instance extraction from a name before the name is -mangled. - -Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> ---- - src/basic/unit-name.c | 48 +++++++++++++++++++++++++++++++----------------- - 1 file changed, 31 insertions(+), 17 deletions(-) - -diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c -index 0a6efa4..93c4838 100644 ---- a/src/basic/unit-name.c -+++ b/src/basic/unit-name.c -@@ -135,42 +135,46 @@ bool unit_suffix_is_valid(const char *s) { - return true; - } - --int unit_name_to_prefix(const char *n, char **ret) { -+static int string_to_prefix(const char *s, char **ret) { - const char *p; -- char *s; -+ char *r; - -- assert(n); -+ assert(s); - assert(ret); - -- if (!unit_name_is_valid(n, UNIT_NAME_ANY)) -- return -EINVAL; -- -- p = strchr(n, '@'); -+ p = strchr(s, '@'); - if (!p) -- p = strrchr(n, '.'); -+ p = strrchr(s, '.'); - - assert_se(p); - -- s = strndup(n, p - n); -- if (!s) -+ r = strndup(s, p - s); -+ if (!r) - return -ENOMEM; - -- *ret = s; -+ *ret = r; - return 0; - } - --int unit_name_to_instance(const char *n, char **instance) { -- const char *p, *d; -- char *i; -- -+int unit_name_to_prefix(const char *n, char **ret) { - assert(n); -- assert(instance); -+ assert(ret); - - if (!unit_name_is_valid(n, UNIT_NAME_ANY)) - return -EINVAL; - -+ return string_to_prefix(n, ret); -+} -+ -+static int string_to_instance(const char *s, char **instance) { -+ const char *p, *d; -+ char *i; -+ -+ assert(s); -+ assert(instance); -+ - /* Everything past the first @ and before the last . is the instance */ -- p = strchr(n, '@'); -+ p = strchr(s, '@'); - if (!p) { - *instance = NULL; - return 0; -@@ -190,6 +194,16 @@ int unit_name_to_instance(const char *n, char **instance) { - return 1; - } - -+int unit_name_to_instance(const char *n, char **instance) { -+ assert(n); -+ assert(instance); -+ -+ if (!unit_name_is_valid(n, UNIT_NAME_ANY)) -+ return -EINVAL; -+ -+ return string_to_instance(n, instance); -+} -+ - int unit_name_to_prefix_and_instance(const char *n, char **ret) { - const char *d; - char *s; --- -1.8.3.1 - diff --git a/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch b/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch deleted file mode 100644 index fca28de59..000000000 --- a/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch +++ /dev/null @@ -1,69 +0,0 @@ -From b7565b3f2d3b13c4ae5734407a2c3f27658c7b4b Mon Sep 17 00:00:00 2001 -From: Brad Bishop <bradleyb@fuzziesquirrel.com> -Date: Thu, 12 Jan 2017 08:52:42 -0500 -Subject: [PATCH 2/2] basic: Use path escaping when mangling path instances - -Allow path instances with dashes in them to be unescaped -properly. - -Fixes systemd/systemd#5072 - -Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> ---- - src/basic/unit-name.c | 18 ++++++++++++++++++ - src/test/test-unit-name.c | 3 +++ - 2 files changed, 21 insertions(+) - -diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c -index 93c4838..c91b0e7 100644 ---- a/src/basic/unit-name.c -+++ b/src/basic/unit-name.c -@@ -684,6 +684,8 @@ static char *do_escape_mangle(const char *f, UnitNameMangle allow_globs, char *t - * If @allow_globs, globs characters are preserved. Otherwise, they are escaped. - */ - int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, const char *suffix, char **ret) { -+ _cleanup_free_ char *instance = NULL; -+ _cleanup_free_ char *prefix = NULL; - char *s, *t; - int r; - -@@ -723,6 +725,22 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, c - return r; - } - -+ r = string_to_instance(name, &instance); -+ if(r < 0 && r != -EINVAL) -+ return r; -+ -+ if(instance && path_is_absolute(instance)) { -+ r = string_to_prefix(name, &prefix); -+ if(r < 0 && r != -EINVAL) -+ return r; -+ -+ r = unit_name_from_path_instance(prefix, instance, suffix, ret); -+ if (r >= 0) -+ return 1; -+ if (r != -EINVAL) -+ return r; -+ } -+ - s = new(char, strlen(name) * 4 + strlen(suffix) + 1); - if (!s) - return -ENOMEM; -diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c -index 2fd83f3..f2cb047 100644 ---- a/src/test/test-unit-name.c -+++ b/src/test/test-unit-name.c -@@ -192,6 +192,9 @@ static void test_unit_name_mangle(void) { - 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); -+ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@/bar.service", "foo@bar.service", 1); -+ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@/bar/baz-boo.service", "foo@bar-baz\\x2dboo.service", 1); -+ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@bar/baz-boo.service", "foo@bar-baz-boo.service", 1); - } - - static int test_unit_printf(void) { --- -1.8.3.1 - diff --git a/meta-phosphor/recipes-core/systemd/systemd_%.bbappend b/meta-phosphor/recipes-core/systemd/systemd_%.bbappend index 7baf1466d..7a4f49c07 100644 --- a/meta-phosphor/recipes-core/systemd/systemd_%.bbappend +++ b/meta-phosphor/recipes-core/systemd/systemd_%.bbappend @@ -8,8 +8,6 @@ PACKAGECONFIG_remove = "machined hibernate ldconfig binfmt backlight localed \ FILESEXTRAPATHS_append := "${THISDIR}/${PN}:" SRC_URI += "file://default.network" SRC_URI += "file://0001-sd-bus-Don-t-automatically-add-ObjectManager.patch" -SRC_URI += "file://0003-basic-Factor-out-string-checking-from-name_to_prefix.patch" -SRC_URI += "file://0004-basic-Use-path-escaping-when-mangling-path-instances.patch" #TODO upstream the below patch via below issue #https://github.com/openbmc/openbmc/issues/2016 SRC_URI += "file://0005-dont-return-error-if-unable-to-create-network-namespace.patch" |