[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setlocale() and gettext() (Re: CVS dpkg flaws)



Previously Fumitoshi UKAI wrote:
> I'm not untested, but why don't set/restore LC_CTYPE locale
> in lib/vercmp.c:ververcmp() ?

Optimization, versinoncompare() can call verrevcmp() twice and we
only set the locale once now. Since verrecvmp() is static we know
nothing else can call it so we are safe now.

> Anyway, your patch may break some error message, since internerr()
> uses gettext().

Ah, bugger. That is easily fixed though. Then again, doing a quick
grep I see there are a bunch more isdigit() calls through the source
that should probably get a similar protection.

> Alternatively, how about implement locale unsensible
> isdigit() and isalpha() if we uses only US-ASCII charset?
> It's not so difficult to implement these, isn't it?

It's quite trivial in fact, but it would be annoying to have to
reimplement such a completely trivial but of libc just to deal
with a design bug in gettext :(

However it seems we have no choice but to do that anyway.. I'll
whip up a patch and commit it to CVS.

Wichert.

-- 
  _________________________________________________________________
 /wichert@wiggy.net         This space intentionally left occupied \
| wichert@deephackmode.org            http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0  2805 3CB8 9250 2FA3 BC2D |



Reply to: