Discussion:
Locale problems on Solaris
Scot Elliott
2002-02-26 10:23:03 UTC
Permalink
Hi there.

With OpenSSH 3.0.2p1 on Solaris, the locale does not appear to get set
correctly at login, as it does with, say telnet:

/etc/default/init:
TZ=GB
CMASK=022
LC_COLLATE=en_GB.ISO8859-1
LC_CTYPE=en_GB.ISO8859-1
LC_MESSAGES=C
LC_MONETARY=en_GB.ISO8859-1
LC_NUMERIC=en_GB.ISO8859-1
LC_TIME=en_GB.ISO8859-1

When logging in via SSH:
scot /home/scot > locale
LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

When logging in via telnet:
scot /home/scot > locale
LANG=
LC_CTYPE=en_GB.ISO8859-1
LC_NUMERIC=en_GB.ISO8859-1
LC_TIME=en_GB.ISO8859-1
LC_COLLATE=en_GB.ISO8859-1
LC_MONETARY=en_GB.ISO8859-1
LC_MESSAGES=C
LC_ALL=


I'd expect the default locale to have been set I think. Any ideas?

Thanks

Scot
Ben Lindstrom
2002-02-26 17:49:46 UTC
Permalink
In --current one should just be able to put in do_setup_env() a:

read_environment_file(&env, &envsize, "/etc/default/init");

for 3.0.2 it would be do_child()

- Ben
I've also experienced this which I solved by setting the locale variables
in /etc/profile but I rather would like SSH to set the right locale for me.
Regards,
Daniel
Post by Scot Elliott
Hi there.
With OpenSSH 3.0.2p1 on Solaris, the locale does not appear to get set
TZ=GB
CMASK=022
LC_COLLATE=en_GB.ISO8859-1
LC_CTYPE=en_GB.ISO8859-1
LC_MESSAGES=C
LC_MONETARY=en_GB.ISO8859-1
LC_NUMERIC=en_GB.ISO8859-1
LC_TIME=en_GB.ISO8859-1
scot /home/scot > locale
LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
scot /home/scot > locale
LANG=
LC_CTYPE=en_GB.ISO8859-1
LC_NUMERIC=en_GB.ISO8859-1
LC_TIME=en_GB.ISO8859-1
LC_COLLATE=en_GB.ISO8859-1
LC_MONETARY=en_GB.ISO8859-1
LC_MESSAGES=C
LC_ALL=
I'd expect the default locale to have been set I think. Any ideas?
Thanks
Scot
_______________________________________________
http://www.mindrot.org/mailman/listinfo/openssh-unix-dev
--
Daniel Bergman
Phone: 08 - 55066265
Mobile: 070 - 289 30 39
Fax: 08 - 59827056
Dan Astoorian
2002-02-26 19:02:05 UTC
Permalink
Post by Ben Lindstrom
read_environment_file(&env, &envsize, "/etc/default/init");
This may be a usable workaround, but it's the wrong solution. Despite
appearances, /etc/default/init does NOT contain environment variables
(per se). Aside from LANG and LC_*, it contains configuration for
/etc/init such as TZ and CMASK, which should not get folded into the
user environment.

It would be preferable to copy LANG, NLSPATH, and all variables
beginning with "LC_" into /etc/environment or $HOME/.ssh/environment.

If you want to fix it in sshd, you should do it by copying those
variables from the parent sshd process to the session, not be reading
/etc/default/init.
--
Dan Astoorian People shouldn't think that it's better to have
Sysadmin, CSLab loved and lost than never loved at all. It's
***@cs.toronto.edu not, it's better to have loved and won. All
www.cs.toronto.edu/~djast/ the other options really suck. --Dan Redican
Daniel Bergman
2002-02-26 21:19:29 UTC
Permalink
I agree with Dan!
Since init reads /etc/default/init and then, on most systems anyway,
launches SSH from /etc/rc[23].d/S[00-99]opensshd, sshd parent process
should have the "correct" locale setting. So copying those variables from
the parent seems like the right approach.

Coping LANG, NLSPATH and LC_* variables into /etc/environment might not be
a bad idea for sysadmins anyway. /etc/profile or ~/.profile should source
that file.

Regards,
Daniel
Post by Dan Astoorian
This may be a usable workaround, but it's the wrong solution. Despite
appearances, /etc/default/init does NOT contain environment variables
(per se). Aside from LANG and LC_*, it contains configuration for
/etc/init such as TZ and CMASK, which should not get folded into the
user environment.
It would be preferable to copy LANG, NLSPATH, and all variables
beginning with "LC_" into /etc/environment or $HOME/.ssh/environment.
If you want to fix it in sshd, you should do it by copying those
variables from the parent sshd process to the session, not be reading
/etc/default/init.
--
Dan Astoorian People shouldn't think that it's better to
--
Daniel Bergman
Phone: 08 - 55066265
Mobile: 070 - 289 30 39
Fax: 08 - 59827056
Email: d-***@home.se
Ben Lindstrom
2002-02-26 21:04:36 UTC
Permalink
Maybe instead of loading up OpenSSH's do_setup_env with hundreds of
potentally unique user variables we should provide a sshd_config option
like 'ChildEnv' which would allow the admin decide what they would to
export.

Then provide Solaris, AIX, etc examples of 'commmonly used' ones
somewhere in contrib/ or in (cringes) sshd_config.

It seems a bit more reasonable then having 30+ different #if
_SOMEPLATFORM/#endif code in OpenSSH portable.

Granted it is semi-redundant since /etc/environment serves the same
thing. Just ensuring people remember to update it when changes
occur.

- Ben
Post by Daniel Bergman
I agree with Dan!
Since init reads /etc/default/init and then, on most systems anyway,
launches SSH from /etc/rc[23].d/S[00-99]opensshd, sshd parent process
should have the "correct" locale setting. So copying those variables from
the parent seems like the right approach.
Coping LANG, NLSPATH and LC_* variables into /etc/environment might not be
a bad idea for sysadmins anyway. /etc/profile or ~/.profile should source
that file.
Regards,
Daniel
Post by Dan Astoorian
This may be a usable workaround, but it's the wrong solution. Despite
appearances, /etc/default/init does NOT contain environment variables
(per se). Aside from LANG and LC_*, it contains configuration for
/etc/init such as TZ and CMASK, which should not get folded into the
user environment.
It would be preferable to copy LANG, NLSPATH, and all variables
beginning with "LC_" into /etc/environment or $HOME/.ssh/environment.
If you want to fix it in sshd, you should do it by copying those
variables from the parent sshd process to the session, not be reading
/etc/default/init.
--
Dan Astoorian People shouldn't think that it's better to
--
Daniel Bergman
Phone: 08 - 55066265
Mobile: 070 - 289 30 39
Fax: 08 - 59827056
Scot Elliott
2002-02-27 10:59:12 UTC
Permalink
Actually from a quick truss of a telnetd process, it seems it calls
setlocale(). I'd suggest that's the way to go rather than reading in
/etc/default/init.


Scot
Post by Ben Lindstrom
read_environment_file(&env, &envsize, "/etc/default/init");
for 3.0.2 it would be do_child()
- Ben
I've also experienced this which I solved by setting the locale variables
in /etc/profile but I rather would like SSH to set the right locale for me.
Regards,
Daniel
Post by Scot Elliott
Hi there.
With OpenSSH 3.0.2p1 on Solaris, the locale does not appear to get set
TZ=GB
CMASK=022
LC_COLLATE=en_GB.ISO8859-1
LC_CTYPE=en_GB.ISO8859-1
LC_MESSAGES=C
LC_MONETARY=en_GB.ISO8859-1
LC_NUMERIC=en_GB.ISO8859-1
LC_TIME=en_GB.ISO8859-1
scot /home/scot > locale
LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
scot /home/scot > locale
LANG=
LC_CTYPE=en_GB.ISO8859-1
LC_NUMERIC=en_GB.ISO8859-1
LC_TIME=en_GB.ISO8859-1
LC_COLLATE=en_GB.ISO8859-1
LC_MONETARY=en_GB.ISO8859-1
LC_MESSAGES=C
LC_ALL=
I'd expect the default locale to have been set I think. Any ideas?
Thanks
Scot
_______________________________________________
http://www.mindrot.org/mailman/listinfo/openssh-unix-dev
--
Daniel Bergman
Phone: 08 - 55066265
Mobile: 070 - 289 30 39
Fax: 08 - 59827056
Dan Astoorian
2002-02-27 16:28:22 UTC
Permalink
Post by Scot Elliott
Actually from a quick truss of a telnetd process, it seems it calls
setlocale(). I'd suggest that's the way to go rather than reading in
/etc/default/init.
I don't think setlocale() solves the problem. I believe it's the case
that setlocale(LC_...,"") uses the LC_*/LANG environment variables (as
opposed to setting them); and that nothing setlocale() does is inherited
through an exec*() call.
--
Dan Astoorian People shouldn't think that it's better to have
Sysadmin, CSLab loved and lost than never loved at all. It's
***@cs.toronto.edu not, it's better to have loved and won. All
www.cs.toronto.edu/~djast/ the other options really suck. --Dan Redican
Scot Elliott
2002-02-27 16:36:22 UTC
Permalink
Ahh I think you're right yes. In Solaris, the /etc/default/init variables
are set by init and inherited by all system processes, hense creating a
default locale. In the environment of the sshd running on my Solaris box,
the LC_ and LANG vars are set, but not in the shell that's run by sshd.
So the setlocale() done by the shell doesn't do anythng. I OpenSSH
removing these variables before exec()ing?

Scot


--
Scot Elliott (E)***@poptart.org (T)07813 651654 (F)07092 010646
PGP key at http://www.poptart.org/scot.asc
Post by Dan Astoorian
Post by Scot Elliott
Actually from a quick truss of a telnetd process, it seems it calls
setlocale(). I'd suggest that's the way to go rather than reading in
/etc/default/init.
I don't think setlocale() solves the problem. I believe it's the case
that setlocale(LC_...,"") uses the LC_*/LANG environment variables (as
opposed to setting them); and that nothing setlocale() does is inherited
through an exec*() call.
--
Dan Astoorian People shouldn't think that it's better to have
Sysadmin, CSLab loved and lost than never loved at all. It's
www.cs.toronto.edu/~djast/ the other options really suck. --Dan Redican
Continue reading on narkive:
Search results for 'Locale problems on Solaris' (Questions and Answers)
3
replies
Windows wont boot in GRUB after Ubuntu install?
started 2010-09-03 15:05:25 UTC
software
Loading...