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

Re: common issue: setlocale handling?



OoO En ce début d'après-midi nuageux  du mardi 31 août 2010, vers 14:56,
"Giacomo A. Catenazzi" <cate@debian.org> disait :

>> I disagree, stuff written in C or Perl doesn't crash when the locale
>> is not set properly and neither should stuff written in Python.

> hmm.
> In C it is because the POSIX application usage don't check for errors.
> I assume POSIX people prefers to use the old locale instead of
> handling the error. [Note it is on the non normative part]
> But a good program probably should check return errors and at minimum
> warn user about failed setlocale, also in C.

Fortunately, we  have a lot  of bad programs  that don't give  a warning
each   time  they  detect   an  incorrect   locale.   Debian   sshd  use
SendEnv/AcceptEnv LANG LC_*. Each time you connect to a system that does
not have your own locale, you  would get some crappy warnings. Each time
you type ls, you'll get a warning. Each time, you type cat, you'll get a
warning, when you use less, you'll get a warning.

When the locale cannot be set,  the program should fall back silently on
any sane default (here, this means C).
-- 
BOFH excuse #140:
LBNC (luser brain not connected)

Attachment: pgpKo34nMI30D.pgp
Description: PGP signature


Reply to: