]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
systemd-systemctl: fix errors in instance name expansion
authorYuta Hayama <hayama@lineo.co.jp>
Wed, 5 Jul 2023 06:06:35 +0000 (15:06 +0900)
committerSteve Sakoman <steve@sakoman.com>
Mon, 31 Jul 2023 18:12:27 +0000 (08:12 -1000)
If the instance name indicated by %i begins with a number, the meaning of the
replacement string "\\1{}".format(instance) is ambiguous.

To indicate group number 1 regardless of the instance name, use "\g<1>".

Signed-off-by: Yuta Hayama <hayama@lineo.co.jp>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit d18b939fb08b37380ce95934da38e6522392621c)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-core/systemd/systemd-systemctl/systemctl

index c8b5c9efe3ed854ca51e1ab3c87f71eebfa1dcf4..0fd7e2408536235a23a475c765c70ac70196de12 100755 (executable)
@@ -191,7 +191,7 @@ class SystemdUnit():
         try:
             for dependent in config.get('Install', prop):
                 # expand any %i to instance (ignoring escape sequence %%)
-                dependent = re.sub("([^%](%%)*)%i", "\\1{}".format(instance), dependent)
+                dependent = re.sub("([^%](%%)*)%i", "\\g<1>{}".format(instance), dependent)
                 wants = systemdir / "{}.{}".format(dependent, dirstem) / service
                 add_link(wants, target)