#2008·distrobox

[Error] Wrong handling of exported bash functions

Author: etamCreated Feb 24, 2026Updated Aug 29, 2026
Labelsbug

Please, before opening a bug:

  • make sure you've read the documentation.
  • Ensure there isn't already an open issue about this.
  • Ensure there isn't already a closed/resolved issue about this.

Describe the bug An exported bash function appears as an environment variable with multiline value. It's incorrectly handled by distrobox, when building "--env" arguments for podman.

To Reproduce

  • either
    • Use openSUSE Tumbleweed as a host OS
    • install mc
  • or
    • run in bash
      bash
      mc()
      {
      . /usr/share/mc/mc-wrapper.sh
      }
      export -f mc
  • verify result
    python
    $ python3
    Python 3.13.11 (main, Dec 19 2025, 18:38:03) [GCC] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os
    >>> os.environ["BASH_FUNC_mc%%"]
    '() {  . /usr/share/mc/mc-wrapper.sh\n}'
  • #notice missing '}' at the end
    $ distrobox enter --dry-run example | grep BASH_FUNC_mc
    --env=BASH_FUNC_mc%%=() {  . /usr/share/mc/mc-wrapper.sh
  • $ distrobox enter example
    /bin/sh: mc: line 1: syntax error: unexpected end of file from `{' command on line 0
    /bin/sh: error importing function definition for `mc'
    bash: mc: line 1: syntax error: unexpected end of file from `{' command on line 0
    bash: error importing function definition for `mc'

Expected behavior It should probably just reject the env variable.

Logs I think it's not relevant here.

Desktop (please complete the following information):

  • Are you using podman, docker or lilipod? podman
  • Which version or podman? 5.7.1
  • Which version of distrobox? 1.8.2.4
  • Which host distribution? openSUSE Tumbleweed
  • How did you install distrobox? from repo