Public bug reported:

I am using systemd version 248.3-1ubuntu3 from the impish repository.

It was compiled and built in the following manner:
# add impish deb-src repository to apt sources
apt build-dep systemd/impish
apt source -b systemd/impish

Once built, it was installed over the top of systemd 245.4-4ubuntu3.

I am running ubuntu 20.04.2.

The source tarball of systemd includes a file
(./debian/systemd/lib/lsb/init-functions.d/40-systemd) which is intended
to be installed into the drop-in script directory provided by the lsb-
base package (/lib/lsb/init-functions.d).

The problem that I am having is that this file (which is sourced by any
script which sources /lib/lsb/init-functions) is setting variables, and
in doing so, accidentally overwriting variables which are configured by
the calling script.

https://gist.github.com/TheWug/e120145f08e994d89e235e077a82ea75#file-40-systemd-L19

I noticed this when investigating why ipmiutil_wdt.service (provided by
package ipmiutil) was failing to start. The problem is that the
ipmiutil_wdt script, which makes use of init-functions, was statically
setting some variables for later use, including one called $prog. $prog
is then inadvertently overwritten by 40-systemd when ipmiutil_wdt
sources /lib/lsb/init-functions.

I think this is systemd's bug because systemd's lsb-base drop-in is not
being a "good neighbor" to the scripts with which it shares a
controlling shell. Even if ipmiutil were to rewrite its ipmiutil-wdt
script, any other such script provided by another package which tries to
use a variable called $prog (or $executable, or $argument, or $service,
or $state, or any of a handful of others) will find its feet being
stepped on by systemd's drop-in.

I propose that the drop-in be modified to encapsulate all of this
behavior where variables are assigned to within a function or subshell
or something, so they can't accidentally contaminate the outside world.

Other related package versions:
lsb-base: 11.1.0ubuntu2
ipmiutil: 3.1.5-1

** Affects: systemd (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1940008

Title:
  systemd lsb-base integration script leaking shell variable changes
  which can break consumers

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1940008/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to