Bug 109011 - /etc/profile.d/less.csh crashes if LANG is unset
/etc/profile.d/less.csh crashes if LANG is unset
Product: Red Hat Raw Hide
Classification: Retired
Component: less (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Karsten Hopp
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2003-11-04 06:14 EST by Stepan Kasal
Modified: 2007-04-18 12:59 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-03-29 04:17:10 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
proposed less.csh (514 bytes, text/plain)
2003-11-12 17:17 EST, Peter E. Popovich
no flags Details
proposed less.sh (354 bytes, application/octet-stream)
2003-11-14 11:22 EST, Stepan Kasal
no flags Details

  None (edit)
Description Stepan Kasal 2003-11-04 06:14:32 EST
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.
Comment 1 Peter E. Popovich 2003-11-08 16:44:08 EST
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?
Comment 2 Karsten Hopp 2003-11-08 17:23:01 EST
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. 
Comment 3 Stepan Kasal 2003-11-10 02:21:59 EST
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.
Comment 4 Peter E. Popovich 2003-11-12 17:17:39 EST
Created attachment 95932 [details]
proposed less.csh

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.
Comment 5 Stepan Kasal 2003-11-14 11:22:56 EST
Created attachment 95972 [details]
proposed less.sh

The less.sh script should also unset LANGVAR.
Comment 6 Karsten Hopp 2004-03-29 04:17:10 EST
the current package doesn't support JLESSCHARSET anymore, the 
whole LANG stuff from the scripts can be removed 

Note You need to log in before you can comment on or make changes to this bug.