Bug#1029161: systemd: Inconsistent values for %j specifier across service and drop-in units
Michael Shaw
mike.shaw.nz at gmail.com
Wed Jan 18 21:07:20 GMT 2023
Apologies.
Systemd (
https://github.com/systemd/systemd/blob/f2af682cd6308f9b26035b83063e6aa8593e468c/docs/CONTRIBUTING.md)
says take the bug to Debian.
Debian (https://www.debian.org/Bugs/Reporting) says don't file bugs
upstream.
Using Systemd version 251.3-1~bpo11+1 produces identical results to those
previously described.
On Wed, 18 Jan 2023 at 17:30, Michael Biebl <biebl at debian.org> wrote:
> Hi
>
> Am 18.01.23 um 18:21 schrieb Mike:
> > Package: systemd
> > Version: 247.3-7+deb11u1
> > Severity: normal
> > X-Debbugs-Cc: mike.shaw.nz+debian at gmail.com
> >
> > Dear Maintainer,
> >
> > Under certain circumstances I'm seeing inconsistent values for the %j
> specifier used in service and drop-in units.
> > To reproduce:
> >
> > Create a systemd unit /lib/systemd/system/foo at .service as:
> >
> > [Unit]
> > Description=good old foo
> >
> > [Service]
> > Type=oneshot
> > ExecStart=/bin/env echo "%%i=[%i] %%j=[%j] (from %n (foo@
> .service))"
> >
> > Create a drop-in unit /etc/systemd/system/foo at .service.d/additional.conf
> as:
> >
> > [Service]
> > ExecStart=/bin/env echo "%%i=[%i] %%j=[%j] (from %n
> (additional.conf))"
> >
> > Reload the systemd units and run systemctl cat foo at .service. The
> output shows the drop-in being correctly incorporated:
> >
> > # /lib/systemd/system/foo at .service
> > [Unit]
> > Description=good old foo
> >
> > [Service]
> > Type=oneshot
> > ExecStart=/bin/env echo "%%i=[%i] %%j=[%j] (from %n (foo@
> .service))"
> >
> > # /etc/systemd/system/foo at .service.d/additional.conf
> > [Service]
> > ExecStart=/bin/env echo "%%i=[%i] %%j=[%j] (from %n
> (additional.conf))"
> >
> > Now create a symlink which contains a %j specifier:
> >
> > sudo ln -sv /lib/systemd/system/foo at .service
> /etc/systemd/system/foo-bar at .service
> >
> > Reload the systemd units and run systemctl cat foo-bar at .service. The
> output is identical to that of systemctl cat foo at .service
> > Now start the service with a %i specifer:
> >
> > systemctl start foo-bar at baz.service
> >
> > The output is:
> >
> > ● foo at baz.service - good old foo
> > Loaded: loaded (/lib/systemd/system/foo at .service; static)
> > Drop-In: /etc/systemd/system/foo at .service.d
> > └─additional.conf
> > Active: inactive (dead)
> >
> > Nov 01 12:10:31 Intel-NUC systemd[1]: Starting good old foo...
> > Nov 01 12:10:31 Intel-NUC env[56108]: %i=[baz] %j=[bar] (from
> foo-bar at baz.service (foo at .service))
> > Nov 01 12:10:31 Intel-NUC env[56109]: %i=[baz] %j=[foo] (from
> foo at baz.service (additional.conf))
> > Nov 01 12:10:31 Intel-NUC systemd[1]: foo at baz.service: Succeeded.
> > Nov 01 12:10:31 Intel-NUC systemd[1]: Finished good old foo.
> >
> > This shows that - in a single invocation - the value for %i is constant
> but the value for %j changes from 'bar' to 'foo'. I would have expected
> the value of %j to be 'bar' throughout. This may not be a bug, but - IMHO
> - this changing of values is unintuitive and I have been unable to find
> documentation that states the expected behaviour in this situation. Happy
> to accept that I have confused/abused systemd with my custom
> /etc/systemd/system/foo-bar at .service symlink.
> >
>
> Ideally, such issues should be tested with the latest version of systemd
> (or at least v251) and then reported upstream.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20230118/8193cc1b/attachment-0001.htm>
More information about the Pkg-systemd-maintainers
mailing list