#2008·distrobox

[错误] 导出 bash 函数处理不正确

作者: etam创建于 2026年2月24日更新于 2026年8月29日
标签bug

请在开 bug 之前先阅读一下文档: - [x] 确保你已经阅读了文档。 - [x] 确保此问题尚未被开启。 - [x] 确保此问题尚未被关闭/解决。 描述 bug 一个导出的 bash 函数以多行值的环境变量形式显示。在为 podman 构建 "--env" 参数时,它被 distrobox 处理错误。 重现 bug - 使用 openSUSE Tumbleweed 作为主机操作系统 - 安装 mc - 或者 - 在 bash 中运行 -sh mc() { . /usr/share/mc/mc-wrapper.sh } export -f mc - 验证结果 -Python $ python3 Python 3.13.11 (main, Dec 19 2025, 18:38:03) [GCC] on linux 请输入"help","copyright","credits"或"license"以获取更多信息。 >>> import os >>> os.environ["BASH_FUNC_mc%%"] '() { . /usr/share/mc/mc-wrapper.sh\n}' - # 注意缺少结尾的 '}' $ 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'

内容来源: 89luca89/distrobox