lib/util/charset Add back setlocale(), but only when called from binaries

Andrew Bartlett abartlet at samba.org
Fri Feb 18 05:04:58 MST 2011


On Fri, 2011-02-18 at 12:35 +0100, Jelmer Vernooij wrote:
> On Fri, 2011-02-18 at 09:30 +0100, Andrew Bartlett wrote:
> > - Log -----------------------------------------------------------------
> > commit 1ad8e5229f618fc04af371ba52b81f2e7e1f88f5
> > Author: Andrew Bartlett <abartlet at samba.org>
> > Date:   Fri Feb 18 13:59:05 2011 +1100
> > 
> >     lib/util/charset Add back setlocale(), but only when called from binaries
> >     
> >     When called from a library, we don't want to call this, as we may
> >     overwrite some of our calling program's context.
> What in particular re-added the need for this? 
> 
> I'm worried about this change as it means we won't be testing the
> library code that e.g. gets used as part of OpenChange and Evolution.
> 
> It would be really nice if we could get rid of our reliance on the
> system locale for once and for all. :-/

Actually, the whole reason for this change was to ensure we don't break
OpenChange and Evolution, while still allowing 'display charset =
LOCALE', which is the default in Samba 3.x.  I didn't continue the
undocumented ability to use LOCALE for unix and dos charsets (where it
makes no sense anyway). 

When we are in a library, we don't want to call setlocale() (which
imports the locale from the environment), so we do it here. 

Previously we would set it unconditionally in all Samba 3.x library
uses, which is considered bad form.

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.



More information about the samba-technical mailing list