Re: my dreams about gtk/freebsd...




"pixel" <pixel@epita.fr> writes:

> Hi Lords,
> 
> I'm angry about this setlocale() stuff. 

angry? 

> The fact is :
> when you have LC_MESSAGES on your system, a
> setlocale(LC_MESSAGES,NULL) can return NULL. This will
> end with a segfault (in gtk_rc_init(), for
> example, you'll :
>     
>     locale = setlocale(LC_MESSAGES,NULL);
>     if (strcmp(locale,"C") && strcmp(locale,"POSIX"))
>         {
>             /* do stuff */
>         }
> 
> Since locale is NULL, you'll understand that this may lead
> to problems). So it *is* necessary to test the setlocale() 
> result.

However, it's bizarre, and almost certainly a bug in
FreeBSD that this does return NULL. 

The typical case where setlocale returns NULL is when
you try to _change_ the locale. Here, we are only
querying the locale. So, this seems to imply that 
FreeBSD defines a LC_MESSAGES constant but barfs
when you try to query the current setting of that
locale.

We can put a workaround into GTK+ (it won't be
the first...); the obvious one is if querying
LC_MESSAGES returns NULL, fall back to querying
LC_CTYPE as we do on systems that don't define
a LC_MESSAGES constant.

You might want to ask the FreeBSD people why
that happens, though...

Regards,
                                        Owen



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