]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.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)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 10 Jul 2023 10:36:06 +0000 (11:36 +0100)
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>
meta/recipes-core/systemd/systemd-systemctl/systemctl

index 514f747fe603cac6d988af2337dcb68dbcac513e..7fe751b397c5927d3e8a47de22898604d1052b17 100755 (executable)
@@ -202,7 +202,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)