Bug 52155 - rpm 4.0.3 segfaults if LC_ALL is unset
Summary: rpm 4.0.3 segfaults if LC_ALL is unset
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 7.1k
Hardware: i586
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-08-21 05:52 UTC by joe
Modified: 2007-04-18 16:36 UTC (History)
0 users

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

Attachments (Terms of Use)

Description joe 2001-08-21 05:52:17 UTC
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 13:09:30 UTC
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 13:16:38 UTC
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 18:03:53 UTC
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.