]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
systemd-systemctl: fix errors in instance name expansion
authorYuta Hayama <hayama@lineo.co.jp>
Thu, 27 Jul 2023 08:19:43 +0000 (17:19 +0900)
committerSteve Sakoman <steve@sakoman.com>
Sat, 12 Aug 2023 15:38:11 +0000 (05:38 -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>".

(From OE-Core rev: d18b939fb08b37380ce95934da38e6522392621c)

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

index b890bdd6f0dcbecb782e5aa57f5dca92f1ab1966..e003c860e3aec5bf469261faa53520442cee2297 100755 (executable)
@@ -189,7 +189,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)