Bug 16130 - systemd template units with instance names containing either '.' or a '\x' escape will not work
Summary: systemd template units with instance names containing either '.' or a '\x' es...
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 5.0.19
Hardware: All Multiple
: Medium normal
Target Milestone: 5.0.17
Assignee: Trent Piepho
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2026-01-13 03:29 UTC by Trent Piepho
Modified: 2026-04-23 15:22 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Proposed fix (2.69 KB, patch)
2026-01-13 03:41 UTC, Trent Piepho
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Trent Piepho 2026-01-13 03:29:36 UTC
The systemctl replacement script that is part of systemd-systemctl-native is unable to properly parse instances that contain escapes or periods.

For example, with real systemctl, these commands will work correctly to create instances of `example@.service`:

```sh
systemctl enable example@host.domain.com.service
systemctl enable example@two\x2dwords.service
```

The former will run the service with the unescaped instance (`%I` in the unit file) set to `host.domain.com` and the latter as `two words`.

The systemctl wrapper script is unable to parse these correctly.  The former will be split on the first period, rather than the last, and try to create the instance `host` of `example@.domain.com.service`.  The latter will try to unescape `\x2d` in the Python script and throw an exception.
Comment 1 Trent Piepho 2026-01-13 03:41:34 UTC
Created attachment 5170 [details]
Proposed fix
Comment 2 Randy MacLeod 2026-01-15 15:37:16 UTC
Hi Trent,
Can you send the patch to the oe-core list?
FYI:
https://docs.yoctoproject.org/contributor-guide/index.html
Comment 3 Ross Burton 2026-01-15 15:39:58 UTC
Note that this won't be required for master/whinlatter/walnascar, as they have removed the replacement script from systemd-systemctl-native (oe-core 7a580800db ("systemd: Build the systemctl executable"))

Also, a related patch would be "systemd.bbclass: support template files with dots".
Comment 4 Paul Barker 2026-02-26 15:06:50 UTC
Hi Trent,

Please re-submit the patch against the appropriate branch (scarthgap and/or kirkstone). As Ross says, this isn't required on walnascar or later and as Antonin says, the patch doesn't apply to the master branch [1].

[1]: https://lore.kernel.org/openembedded-core/DFT9J4U0CL9Z.1B3K1AOQP1914@bootlin.com/
Comment 5 Yoann Congal 2026-03-12 15:21:29 UTC
Patch sent to ML but not tagged for scarthgap:
https://lore.kernel.org/openembedded-core/20260120011745.2474832-1-trent.piepho@igorinstitute.com/
Comment 6 Yoann Congal 2026-03-19 15:15:42 UTC
Patch currently in review
Comment 7 Yoann Congal 2026-04-23 15:22:01 UTC
Fixed on scarthgap:
systemd-systemctl: Fix instance name parsing with escapes or periods - openembedded-core - OpenEmbedded Core layer
https://git.openembedded.org/openembedded-core/commit/?h=scarthgap&id=0514c317523330f75937123c45bb0528e4830f61