Red Hat Bugzilla – Bug 52155
rpm 4.0.3 segfaults if LC_ALL is unset
Last modified: 2007-04-18 12:36:05 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)
static char nameBuf; /* XXX yuk */
char *s, locale;
/* 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));
In this situation, setlocale will return NULL and rpm will
Version-Release number of selected component (if applicable):
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
Hmmm, I did
rpm -q rpm
rpm -V rpm
all w/o problem.
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.
AFAICT, this problem no longer applies to rpm-4.0.4 and later.