Bug 109011 - /etc/profile.d/less.csh crashes if LANG is unset
Summary: /etc/profile.d/less.csh crashes if LANG is unset
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: less
Version: 1.0
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-04 11:14 UTC by Stepan Kasal
Modified: 2007-04-18 16:59 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-03-29 09:17:10 UTC
Embargoed:


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

Description Stepan Kasal 2003-11-04 11:14:32 UTC
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):
less-378-11.1

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 21:44:08 UTC
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 22:23:01 UTC
You're asked during the installation which language you'd like 
to install in. This selection is then written to 
/etc/sysconfig/i18n. 
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 07:21:59 UTC
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 22:17:39 UTC
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."

ref:
http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html#tag_08_02


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 16:22:56 UTC
Created attachment 95972 [details]
proposed less.sh

The less.sh script should also unset LANGVAR.

Comment 6 Karsten Hopp 2004-03-29 09:17:10 UTC
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.