This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: perror, gettext, question marks


Ulrich Drepper writes:

> > You can argue that all programs should call setlocale(LC_ALL,"") but this
> > doesn't practically work because:
> 
> And this is what has to happen.  There are many more possibilities how
> you can shoot yourself in the foot by not setting the locales
> correctly.  Either you don't use locales or you do it correctly.

But bzip2 has not set locales incorrectly. It has not set any locales
at all; this is the default startup mode in ISO C. You cannot say
that's incorrect.

The error is one of the following - depending on your point of view -:

  a) bzip2 has done the equivalent of setlocale(LC_ALL,"C") but
     perror() is still producing a German message. gettext() should
     disregard the value of LANGUAGE unless setlocale has been called.

  b) perror, via gettext, does something outside of the scope of ISO C:
     It looks at the value of LANGUAGE. This is a GNU extension, fine.
     But the GNU extension is badly implemented, because it leads to
     unpleasant error messages when neither the user nor the program
     has done something incorrect. So let's fix the GNU extension.

I don't think we can fix (a) in a portable way, because there is no
way how we can enhance setlocale() on non-glibc systems. Remains (b).

Bruno

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]