[Bug 279934] New: ssh doesn't send locale environment when a command is executed remotely
https://bugzilla.novell.com/show_bug.cgi?id=279934 Summary: ssh doesn't send locale environment when a command is executed remotely Product: openSUSE 10.3 Version: Alpha 4plus Platform: Other OS/Version: Linux Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: mfabian@novell.com QAContact: qa@suse.de I'm running in a Japanese locale: mfabian@magellan:~$ locale LANG=ja_JP.UTF-8 LC_CTYPE="ja_JP.UTF-8" LC_NUMERIC="ja_JP.UTF-8" LC_TIME="ja_JP.UTF-8" LC_COLLATE="ja_JP.UTF-8" LC_MONETARY="ja_JP.UTF-8" LC_MESSAGES="ja_JP.UTF-8" LC_PAPER="ja_JP.UTF-8" LC_NAME="ja_JP.UTF-8" LC_ADDRESS="ja_JP.UTF-8" LC_TELEPHONE="ja_JP.UTF-8" LC_MEASUREMENT="ja_JP.UTF-8" LC_IDENTIFICATION="ja_JP.UTF-8" LC_ALL= mfabian@magellan:~$ Now, when I login to the machine "shannon" which has a German locale as the system default setup in /etc/sysconfig/language, the following happens: mfabian@magellan:~$ ssh shannon Last login: Thu May 31 16:05:46 2007 from magellan.suse.de Have a lot of fun... mfabian@shannon:~$ locale LANG=ja_JP.UTF-8 LC_CTYPE="ja_JP.UTF-8" LC_NUMERIC="ja_JP.UTF-8" LC_TIME="ja_JP.UTF-8" LC_COLLATE="ja_JP.UTF-8" LC_MONETARY="ja_JP.UTF-8" LC_MESSAGES="ja_JP.UTF-8" LC_PAPER="ja_JP.UTF-8" LC_NAME="ja_JP.UTF-8" LC_ADDRESS="ja_JP.UTF-8" LC_TELEPHONE="ja_JP.UTF-8" LC_MEASUREMENT="ja_JP.UTF-8" LC_IDENTIFICATION="ja_JP.UTF-8" LC_ALL= mfabian@shannon:~$ That is fine, I get my usual Japanese locale, the locale specific environment variables are transmitted. *But* if I give the "locale" command directly on the ssh command line: mfabian@magellan:~$ ssh shannon locale stty: Standardeingabe: Das Argument ist ungültig mesg: ttyname: Unpassender IOCTL (I/O-Control) für das Gerät LANG=de_DE.UTF-8 LC_CTYPE="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_PAPER="de_DE.UTF-8" LC_NAME="de_DE.UTF-8" LC_ADDRESS="de_DE.UTF-8" LC_TELEPHONE="de_DE.UTF-8" LC_MEASUREMENT="de_DE.UTF-8" LC_IDENTIFICATION="de_DE.UTF-8" LC_ALL= mfabian@magellan:~$ I get the default German locale on "shannon", i.e. my locale specific environment variables are *not* transmitted. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 mhorvath@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team- |anicka@novell.com |screening@forge.provo.novell| |.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 nadvornik@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nadvornik@novell.com ------- Comment #1 from nadvornik@novell.com 2007-06-04 04:04 MST ------- LANG is transferred correctly, but seems to be overwritten by /etc/profile or /etc/bash.bashrc. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 nadvornik@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|anicka@novell.com |ro@novell.com ------- Comment #2 from nadvornik@novell.com 2007-06-04 07:11 MST ------- The problem is that /etc/profile.d/sh.ssh does not work for non-interactive ssh, because SSH_TTY is empty. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 ro@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|ro@novell.com |werner@novell.com ------- Comment #3 from ro@novell.com 2007-06-04 08:18 MST ------- that file was created by werner during processing of bug#65747 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 werner@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |werner@novell.com AssignedTo|werner@novell.com |anicka@novell.com ------- Comment #4 from werner@novell.com 2007-06-04 08:43 MST ------- Please read more deeper /etc/profile.d/sh.ssh and /etc/profile.d/csh.ssh only test if the ssh connection provides a terminal line and checks up if any of the locale variable set. Only if both a locale variable and a tty is provided by the ssh connection the scripts /etc/profile.d/sh.utf8 and /etc/profile.d/csh.utf8 are called to possible edit the locale variable to reflect the UTF-8 capability of the local terminal line. Please note that /etc/profile.d/sh.utf8 and /etc/profile.d/csh.utf8 uses the program testutf8 and requires a terminal line which can be tested. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 nadvornik@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|anicka@novell.com |werner@novell.com ------- Comment #5 from nadvornik@novell.com 2007-06-04 09:25 MST ------- As I understand the scripts, exporting SSH_SENDS_LOCALE=yes means "do not touch any locale variable", right?
Only if both a locale variable and a tty is provided by the ssh connection the scripts /etc/profile.d/sh.utf8 and /etc/profile.d/csh.utf8 are called to possible edit the locale variable to reflect the UTF-8 capability of the local terminal line.
Sorry, but I read it just opposite: if test -z "$SSH_SENDS_LOCALE" ; then if test -r /etc/sysconfig/language -a -r /etc/profile.d/sh.utf8 ; then tmp="$(. /etc/sysconfig/language; echo $AUTO_DETECT_UTF8)" test "$tmp" = "yes" && . /etc/profile.d/sh.utf8 unset tmp fi fi What I need is to export SSH_SENDS_LOCALE=yes also in situations, when the shell is called from sshd, there is no tty and the locale variables are set. This change should do it: --- sh.ssh.orig 2005-03-03 11:48:10.000000000 +0100 +++ sh.ssh 2007-06-04 17:15:32.000000000 +0200 @@ -20,7 +20,7 @@ return 1 } -if test -n "$SSH_TTY" && test_lc ; then +if test -n "$SSH_CONNECTION" && test_lc ; then SSH_SENDS_LOCALE=yes export SSH_SENDS_LOCALE fi -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 werner@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|werner@novell.com |nadvornik@novell.com ------- Comment #6 from werner@novell.com 2007-06-04 09:53 MST ------- This does _not_ work for all cases, it is a matter of fact, that ssh does not provide any locale in case of not having a login session. In other words: you will use the locale of the local systems which may or may not fit. Beside this the /etc/profile.d/*.utf8 will only work if and only if a terminal line is used: /suse/werner> testutf8 < /dev/null /suse/werner> echo $? 0 /suse/werner> testutf8 /suse/werner> echo $? 1 /suse/werner> echo -ne '\e%G' > /dev/tty /suse/werner> testutf8 /suse/werner> echo $? 2 as you can see on the exit status of testutf8 used by /etc/profile.d/*.utf8. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 ------- Comment #7 from werner@novell.com 2007-06-04 10:02 MST ------- Exit status 1 of testutf8 means non UTF-8 terminal line and status 2 means UTF-8 terminal line and /etc/profile.d/*.utf8 only handles this both cases. The exit status of 0 is ignored. IMHO the case `-z "$SSH_SENDS_LOCALE"' does exactly nothing for a ssh connection without any terminal line. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 nadvornik@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|nadvornik@novell.com |werner@novell.com ------- Comment #8 from nadvornik@novell.com 2007-06-04 10:23 MST ------- NO. For a ssh connection without any terminal line, no matter if it sends locale variables or not: SSH_TTY is empty, the test '-n "$SSH_TTY" && test_lc' in sh.ssh is false SSH_SENDS_LOCALE is empty the test '-z "$SSH_SENDS_LOCALE"' is true testutf8 is called Maybe the fix proposed in comment 5 is not enough and the situation of ssh connection without tty which does not send locale must be handled specially. Anyway, there is a bug for sure and can be fixed only in these scripts. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=279934 mfabian@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #9 from mfabian@novell.com 2007-06-04 10:40 MST ------- comment #5 seems to be correct. Thank you Vladimir! Werner and me have submitted a aaa_base with that change now. If SSH_SENDS_LOCALE is not set, /etc/profile.d/lang.sh will overwrite the locale which has been sent by ssh again with the system locale. Therefore, /etc/profile.d/*.ssh should set SSH_SENDS_LOCALE for *all* ssh connections, not only those which have a tty. Closing bug as FIXED. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com