From: Xiangyu Chen <xiangyu.c...@windriver.com> libvirt has added a feature that all sockets for a service being enabled when a single one of them is enabled since 9.9.x[1], it likes serviceA enable serviceB, serviceB enable serviceA, that cause our systemctl script trap into a dead loop in postinstall stage, the error message as below:
Traceback (most recent call last): File "/usr/lib/python3.8/pathlib.py", line 722, in __str__ return self._str AttributeError: _str During handling of the above exception, another exception occurred: Traceback (most recent call last): File "recipe-sysroot-native/usr/bin/systemctl", line 255, in enable SystemdUnit(self.root, also).enable(unit) File "recipe-sysroot-native/usr/bin/systemctl", line 255, in enable SystemdUnit(self.root, also).enable(unit) File "recipe-sysroot-native/usr/bin/systemctl", line 255, in enable SystemdUnit(self.root, also).enable(unit) [Previous line repeated 988 more times] ...... RecursionError: maximum recursion depth exceeded while calling a Python object Here using an array to record the services which has been enabled to filter the duplicates. Ref: [1] https://github.com/libvirt/libvirt/commit/826931e95a38af8322f8ad069dc89117c6404a00 Signed-off-by: Xiangyu Chen <xiangyu.c...@windriver.com> --- meta/recipes-core/systemd/systemd-systemctl/systemctl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 7fe751b397..2229bc7b6d 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -209,7 +209,7 @@ class SystemdUnit(): except KeyError: pass - def enable(self, caller_unit=None): + def enable(self, units_enabled=[]): # if we're enabling an instance, first extract the actual instance # then figure out what the template unit is template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit) @@ -248,8 +248,9 @@ class SystemdUnit(): try: for also in config.get('Install', 'Also'): try: - if caller_unit != also: - SystemdUnit(self.root, also).enable(unit) + units_enabled.append(unit) + if also not in units_enabled: + SystemdUnit(self.root, also).enable(units_enabled) except SystemdUnitNotFoundError as e: sys.exit("Error: Systemctl also enable issue with %s (%s)" % (service, e.unit)) -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#195958): https://lists.openembedded.org/g/openembedded-core/message/195958 Mute This Topic: https://lists.openembedded.org/mt/104484353/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-