Bug 52155 - rpm 4.0.3 segfaults if LC_ALL is unset
rpm 4.0.3 segfaults if LC_ALL is unset
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
i586 Linux
medium Severity high
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-08-21 01:52 EDT by joe
Modified: 2007-04-18 12:36 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-08-21 09:16:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description joe 2001-08-21 01:52:17 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.3) Gecko/20010802

Description of problem:
There is a bug in rpm 4.0.3 that causes a segfault if 
LC_ALL is unset.  In the file tagName.c

const char *const tagName(int tag)
    int i;
    static char nameBuf[128];	/* XXX yuk */
    char *s, locale[128];

    /* Turkic locales have tolower('I') != 'i' */

Please note that this is a particular problem since if glibc is
reinstalled LC_ALL will get unset and the rpm update will fail.
    strncpy(locale, setlocale(LC_ALL, ""), sizeof(locale));
    setlocale(LC_ALL, "C");

In this situation, setlocale will return NULL and rpm will 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. unset LC_ALL
2. run any rpm command using 4.0.3

Actual Results:  immediate segfault

Expected Results:  rpm should run normally

Additional info:
Comment 1 Jeff Johnson 2001-08-21 09:09:30 EDT
Hmmm, I did
	unset LC_ALL
	rpm -qa
	rpm -q rpm
	rpm -V rpm
all w/o problem.
Comment 2 Jeff Johnson 2001-08-21 09:16:38 EDT
I've played a bit more with rpm.  The problem appears to be not
setting LC_ALL to (null) but rather if you get into a situation in
which locales are not installed (i.e. if you are reinstalling glibc
and delete the old locales).

In that case setlocale returns NULL and the code I referenced breaks.

The code should be changed to handle a NULL return from setlocale.
Even a warning message would be really useful.
Comment 3 Jeff Johnson 2002-07-01 14:03:53 EDT
AFAICT, this problem no longer applies to rpm-4.0.4 and later.

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