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

Andrew Bartlett abartlet at samba.org
Fri Feb 18 14:28:02 MST 2011


On Fri, 2011-02-18 at 13:33 +0100, Jelmer Vernooij wrote:
> On Fri, 2011-02-18 at 23:04 +1100, Andrew Bartlett wrote:
> > 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). 
> What's the value of display charset = LOCALE if the locale is being
> reset?

The special properties of the setlocale() call are that "" means 'get
from the environment'.  But, as far as Tridge and I could determine, we
can't tell if the that has already been done by the calling application,
or if the calling application had obtained it from other mechanism, such
as gconf. 

> > 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.
> I'm confused. Samba 3 never used this code as far as I know, only Samba
> 4 did. 

This code is now in common, and so needs to support the Samba 3
parameters. 

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