Red Hat Bugzilla – Bug 91403
xinetd uses inappropriate locale settings
Last modified: 2014-08-31 19:25:04 EDT
Description of problem:
See description of bug 43762 for a more agressive (but accurate) version of this
Version-Release number of selected component (if applicable):
Steps to Reproduce:
In the above-mentioned bug, email@example.com states that: 'en_US is "C", with
working character order and 8 bit characters.' This should say, 'with
*different* character order'. If xinetd is going to provide a default, it
should provide the default that makes most sense - that is, nothing. Every time
xinetd is upgraded, i have to edit /etc/rc.d/init.d/xinetd to restore the
default behaviour. An extract follows:
# Need to get rid of localization for external services -
# it doesn't make much sense to have i18n on the server side here
export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
The comment is not an accurate reflection of the code - en_US is just as much a
localization as any other. If we were indeed getting rid of localization, the
above should read:
unset LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
/tmp $ mkdir a
/tmp $ cd a
/tmp/a $ touch A b C d E f G
/tmp/a $ LANG=en_US ls
. .. A b C d E f G
/tmp/a $ LANG=C ls
. .. A C E G b d f
This shows that LANG=en_US does not achieve the same result as LANG=C.
The same as it was before: no LANG setting in programs started from xinetd,
except what is set by themselves. This allows programs which need localization
to sensibly test whether it is in place already or not.
At the very least, the comment in the xinetd startup script should be corrected
to state that we are using Red Hat's default choice for localization rather than
saying we are getting rid of it, and bug 43762 should be updated to "WONTFIX"
rather than "NOTABUG".
Created attachment 91888 [details]
Proposed patch for /etc/rc.d/init.d/xinetd
Created attachment 91889 [details]
Second proposed patch for /etc/rc.d/init.d/xinetd
On second thoughts, this patch is probably more flexible. It would allow those
of us who want the old behaviour to put XINETD_UNSET_LANG=1 in our
/etc/sysconfig/xinetd, and the rest could have it the new way. I would be
happy for XINETD_UNSET_LANG=0 to be the default, or even for it to be unset and
undocumented. As firstname.lastname@example.org said in bug 43762, we need an easy way
to get the traditional behaviour, and one that doesn't require manual
intervention every time xinetd gets upgraded.
I came up with a slightly different patch, which I included in
xinetd-2.3.12-1.10.0 (now in Raw Hide). In /etc/sysconfig/xinetd, I added an
XINETD_LANG paramater, which can be set to a locale, or the string "none". If
it's "none", all locale environment variables are cleared before xinetd is
run. Otherwise, xinetd runs in the specified locale. The default
configuration file sets it to "en_US", so default users get the old behavior.
I don't know if xinetd-2.3.12-1.10.0 will run on a Red Hat Linux 9 system, but
you can certainly download the SRPM and do a rpmbuild --rebuild on it.
There's a typo in the comments in /etc/init.d/xinetd (synconfig vs. sysconfig),
but otherwise looks good. I've thrown a comment in 43762 to point people this way.