Zerobrane 不访问环境

问题描述

我要从 Ubuntu 20.04 迁移到 Debian 10。现在 Lua 5.3 没有使用“require”找到我自己的模块。之前在 Ubuntu 上运行良好,我怀疑我现在遗漏了什么......

欢迎指点!谢谢

在 ~/.bashrc 中我从以前的安装中复制:

export LUA_PATH_5_3="/home/martin/lua/?.lua;;"
export LUA_PATH="/home/martin/lua/?.lua;;"

运行编译时我明白了,所以它没有查看正确的文件

module 'weeknumber' not found:
no field package.preload['weeknumber']
no file '/usr/local/share/lua/5.3/weeknumber.lua'
no file '/usr/local/share/lua/5.3/weeknumber/init.lua'
no file '/usr/local/lib/lua/5.3/weeknumber.lua'
no file '/usr/local/lib/lua/5.3/weeknumber/init.lua'
no file './weeknumber.lua'
no file './weeknumber/init.lua'
no file './weeknumber.lua'
no file './weeknumber/init.lua'
no file './lua/weeknumber.lua'
no file './lua/weeknumber/init.lua'
no file '/opt/zbstudio/lualibs/weeknumber/weeknumber.lua'
no file '/opt/zbstudio/lualibs/weeknumber.lua'
no file '/opt/zbstudio/lualibs/weeknumber/weeknumber/init.lua'
no file '/opt/zbstudio/lualibs/weeknumber/init.lua'
no file '/opt/zbstudio/lualibs/weeknumber.lua'
no file '/opt/zbstudio/lualibs/weeknumber/weeknumber.lua'
no file '/opt/zbstudio/lualibs/weeknumber/init.lua'
no file '/usr/local/lib/lua/5.3/weeknumber.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './weeknumber.so'
no file '/opt/zbstudio/bin/linux/x64/clibs53/weeknumber.so'
no file '/opt/zbstudio/bin/linux/x64/clibs53/libweeknumber.so'

测试

print ( os.getenv("PATH"))
print ( os.getenv("LUA_PATH_5_3"))
print ( os.getenv("LUA_PATH"))

显示环境没有被拾取,甚至PATH也不完整。我也试过 .profile,没有变化:

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
nil
;;./?.lua;./?/init.lua;./lua/?.lua;./lua/?/init.lua;/opt/zbstudio/lualibs/?/?.lua;/opt/zbstudio/lualibs/?.lua;/opt/zbstudio/lualibs/?/?/init.lua;/opt/zbstudio/lualibs/?/init.lua;/opt/zbstudio/lualibs/?.lua;/opt/zbstudio/lualibs/?/?.lua;/opt/zbstudio/lualibs/?/init.lua

解决方法

这是经过多次尝试后的答案。因为 Zerobrane 是一个 X11 程序而不是终端程序,所以不评估 ~/.profile 或 ~/.bashrc 中的条目。 X11 有自己的机制,显然在 Debian 和 Ubuntu 上的工作方式有点不同。

解决方案(几个选项之一):将所有重要条目放入 ~/.xsessionrc

export LUA_PATH_5_3="/home/martin/lua/?.lua;;"
export LUA_PATH="/home/martin/lua/?.lua;;"
export PATH=<some relevant path>/bin:$PATH

懒惰,我重新启动,一切正常。我从 ~/.profile 和 /etc/profile 中删除了所有条目,只剩下 ~/.bashrc 所以终端会话有那些环境会话。