Escaped systemd unit retruns wrongly escaped (and different) Id

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 7.5
  • systemd-219-62.el7.x86_64

Issue

Querying the Id of a unit shows a different unit name on RHEL 7.5, while it doesn't on fedora.

Steps to Reproduce:

Run show all and grep the Id of an escaped unit

#  /usr/bin/systemctl --no-pager --all show -- 'systemd-fsck@dev-mapper-vg0\x2dscratch.service' |grep Id=
Id=systemd-fsck@dev-mapper-vg0\x5cx2dscratch.service

The extra x5c is the backslash (\) that systemd escaped.

On fedora27, it gives the correct Id:

 /usr/bin/systemctl --no-pager --all show -- "systemd-fsck@dev-mapper-vg0\x2dscratch.service" |grep Id=
Id=systemd-fsck@dev-mapper-vg0\x2dscratch.service

Resolution

Update to systemd-219-62.el7_6.6 shipped with Advisory RHBA-2019:0820 or newer.

Root Cause

Before the update a bug in bus_print_property() function caused printing of erroneous output.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.