su - user -c sets locale variables to "POSIX"
I need to run SBCL in a UTF-8 environment in a VM running Arch. When I log in as the dedicated user and run the start script, it runs in UTF-8 and works fine. However I need to start it through a (bash) script, and when I run it with:
su - user -c /var/lib/.../start-script
it runs in an environment with all language variables set to POSIX, which causes errors.
I have set LOCALE to en_US.UTF-8 in rc.conf and checked locale.gen, and both the root and the user use this normally. Running locale as root shows all variables set properly to en_US.UTF-8.
Yet when I do su - user -c locale, it's all set to POSIX.
How is this possible, who is this user su runs as, what should I do?
EDIT: It works if I do:
su - user -c export LANG=en_US.UTF-8 && /var/lib/.../start-script
I don't understand why this is required.
EDIT: I read about some update late last year, which made /etc/profile.d/locale.sh obsolete (?) and made /etc/locale.conf take precedence over /etc/rc.conf. Following those instructions isn't working for me though. Moving locale.sh and using /etc/locale.conf sets all vars to POSIX for all users; if I keep it it's still the same as I originally described.
Last edited by Gaidal; 01-20-2012 at 03:06 AM.