[Bug 2122622] Re: Loading environment before executing script is broken

Ryan Govostes 2122622 at bugs.launchpad.net
Thu Sep 11 20:59:54 UTC 2025


** Description changed:

- /usr/bin/lb tries to load some environment variables from
- config/environment and config/environment.binary
+ With live-build 3.0~a57-1ubuntu49.1 on Noble, /usr/bin/lb tries to load
+ some environment variables from config/environment and
+ config/environment.binary
  
-     ENV=""
+     ENV=""
  
-     for _FILE in config/environment config/environment.binary
-     do
-         if [ -e "${_FILE}" ]
-         then
-             ENV="${ENV} $(grep -v '^#' ${_FILE})"
-         fi
-     done
+     for _FILE in config/environment config/environment.binary
+     do
+         if [ -e "${_FILE}" ]
+         then
+             ENV="${ENV} $(grep -v '^#' ${_FILE})"
+         fi
+     done
  
  Then it executes
  
-     LB=1 ${ENV} exec "${SCRIPT}" "${@}"
+     LB=1 ${ENV} exec "${SCRIPT}" "${@}"
  
  The intention is that ${ENV} here will expand to FOO=BAR etc. and
  thereby populate the environment when executing the script. But the
  shell doesn't allow you to do this; it will interpret ${ENV} as a
  command name. Here's a minimal demonstration:
  
-     $ sh -c 'FOO="A=B"; ${FOO} /usr/bin/env'
-     sh: 1: A=B: not found
+     $ sh -c 'FOO="A=B"; ${FOO} /usr/bin/env'
+     sh: 1: A=B: not found
  
  The upstream Debian version does it correctly:
  
-     exec /usr/bin/env ${ENV} "${SCRIPT}" ${GLOBAL_ARGS} "${@}"
+     exec /usr/bin/env ${ENV} "${SCRIPT}" ${GLOBAL_ARGS} "${@}"
  
  Fixed here: https://salsa.debian.org/live-team/live-
  build/-/commit/8b1f9f0131a96cf2a6b3764de5140e13a3adb3eb

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

Title:
  Loading environment before executing script is broken

Status in live-build package in Ubuntu:
  New

Bug description:
  With live-build 3.0~a57-1ubuntu49.1 on Noble, /usr/bin/lb tries to
  load some environment variables from config/environment and
  config/environment.binary

      ENV=""

      for _FILE in config/environment config/environment.binary
      do
          if [ -e "${_FILE}" ]
          then
              ENV="${ENV} $(grep -v '^#' ${_FILE})"
          fi
      done

  Then it executes

      LB=1 ${ENV} exec "${SCRIPT}" "${@}"

  The intention is that ${ENV} here will expand to FOO=BAR etc. and
  thereby populate the environment when executing the script. But the
  shell doesn't allow you to do this; it will interpret ${ENV} as a
  command name. Here's a minimal demonstration:

      $ sh -c 'FOO="A=B"; ${FOO} /usr/bin/env'
      sh: 1: A=B: not found

  The upstream Debian version does it correctly:

      exec /usr/bin/env ${ENV} "${SCRIPT}" ${GLOBAL_ARGS} "${@}"

  Fixed here: https://salsa.debian.org/live-team/live-
  build/-/commit/8b1f9f0131a96cf2a6b3764de5140e13a3adb3eb

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/live-build/+bug/2122622/+subscriptions




More information about the foundations-bugs mailing list