Red Hat Bugzilla – Bug 109011
/etc/profile.d/less.csh crashes if LANG is unset
Last modified: 2007-04-18 12:59:06 EDT
Description of problem:
The less.csh doesn't work if neither LANG nor LC_ALL is set.
tcsh says LANG: unset variable and skips .cshrc (that is why I marked
this bug with Severity:high).
Version-Release number of selected component (if applicable):
The less.csh/less.sh scripts should be reviewed. Neither of them
thinks about the case that both LANG and LC_ALL are unset. (bash just
is not that sensitive to crash on it.) And both less.sh and less.csh
leave a variable in the environment: LANGVAR.
Sorry, I've no patch, I've just deleted that section as I don't use
jp nor ko characters.
less-378-11.1 is in the Fedora 1 release, so the ticket owner may want
to change the product field of this ticket from rawhide to fedora.
i've got a specially tailored minimal install, so i may have stumbled
into this by not having a package that normal fedora installs would.
is there some package / install step that's supposed to set LANG?
You're asked during the installation which language you'd like
to install in. This selection is then written to
At startup of tcsh, bash... the file /etc/profile.d/lang.[c]sh gets
executed and reads in and sets LANG.
As it is impossible to skip the language selection or to deinstall
the initscripts package (which provides /etc/profile.d/lang.[c]sh),
I can only come to the conclusion that something in your system
is hosed. Please check that the mentioned files are installed and
that LANG is set in /etc/sysconfig/i18n.
Sure, my configuration is strange, I've manually edited /etc/sysconfig/i18n to unset LANG. (I'll explain below.)
But I think the script should not crash in this case.
A simple ``if ($?LANG || $?LC_ALL)'' enclosing the code would do; if someone unsets LANG, they are on their own, but why crash?
And the script should end with ``unsetenv LANGVAR''; less.sh should end with unset LANGENV.
The explanation why I have unset LANG: my users want LANG=C and ``man'' doesn't work with it (I've filed another bug report); so I unset LANG.
Created attachment 95932 [details]
I've had the opportunity to do some research. IEEE Std 1003.1 defines LANG,
LC_ALL, et. al. It also defines behavior in the absence of LANG:
"4. If the LANG environment variable is not set or is set to the empty string,
the implementation-defined default locale shall be used."
as recently as 378-7, less.csh behaves gracefully in the absence of LANG. It
does appear that simply wrapping the entire LANGVAR section with ``if ($?LANG
|| $?LC_ALL)'' would address the problem.
As for unsetting LANGVAR at the end of less.csh, it appears that using ``set
LANGVAR'' instead of ``setenv LANGVAR'' would address this issue.
A proposed less.csh is attached.
Created attachment 95972 [details]
The less.sh script should also unset LANGVAR.
the current package doesn't support JLESSCHARSET anymore, the
whole LANG stuff from the scripts can be removed