Fedora 15 区域设置未正确设置
我有一个在 Fedora 15 上运行的 C 程序(DHCPD);它使用 on commit
语句(该语句又使用 exec
命令)来调用脚本。当所有语言环境文件(例如 i18n)设置为 en_GB.utf8
时,脚本的 $LANG
变量始终设置为 en_US.UTF-8
>。
有趣的是,当从 shell 提示符运行脚本时,$LANG
变量设置为 en_GB.utf8
- 如何让它使用 en_GB.utf8
当从 DHCPD 程序调用时???
I have a C program (DHCPD) running on Fedora 15; it uses the on commit
statement (which in turn uses the exec
command) to call a script. The $LANG
variable of the script is always set to en_US.UTF-8
when all locale files (e.g. i18n) are set to en_GB.utf8
.
Interestingly, when the script is run from a shell prompt, the $LANG
variable is set to en_GB.utf8
- how do I get it to use en_GB.utf8
when called from the DHCPD program???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先要做的就是检查
/etc/sysconfig/i18n
并查看LANG
的设置。Fedora 15 将使用 systemd 来启动 dhcpd 等服务,它将忽略用户环境并为每个守护进程提供一个干净的环境。它确实从
/etc/sysconfig/i18n
获取设置,因此守护进程应该使用那里指定的设置运行。如果这似乎是正确的,请查看
/proc/NNN/environ
,其中 NNN 是 dhcpd 进程的 PID,以查看LANG
设置的内容。请注意,该文件是原始环境,因此每个字符串之间都有一个二进制 nul。如果这是您所期望的,那么最可能的答案是 dhcpd 在调用其配置文件中指定的脚本之前有意清理环境。
Well the first thing to do is to check
/etc/sysconfig/i18n
and see whatLANG
is set to.Fedora 15 will be using
systemd
to start services likedhcpd
and it will ignore the users environment and give each daemon that it starts a clean environment. It does take settings from/etc/sysconfig/i18n
though so daemons should run with the settings specified there.If that seems to be correct that look at
/proc/NNN/environ
where NNN is the PID of your dhcpd process to see whatLANG
is set to. Note that this file is the raw environment so has a binary nul between each string.If that is what you expect then the most likely answer is that
dhcpd
is deliberately cleaning the environment before invoking scripts specified in it's configuration file.