Hey. Not sure whether this is a bug, but I guess so. When doing e.g. SetEnv LC_ALL=C SetEnv LC_ALL=C.UTF-8 only the former will show up in e.g. -G as: setenv LC_ALL=C respectively -v as: debug1: channel 0: setting env LC_ALL = "C" which is, I guess, as it should be. However, when using: SetEnv LC_ALL=C LC_ALL=C.UTF-8 -G will give: setenv LC_ALL=C setenv LC_ALL=C.UTF-8 and -v: debug1: channel 0: setting env LC_ALL = "C" debug1: channel 0: setting env LC_ALL = "C.UTF-8" and in the remote shell, the env var is actually set to the latter ("C.UTF-8"). If actually desired, than at least this should be documented in SetEnv. And -G should probably only print the one line that actually matters. Thanks, Chris.
This bug is referenced in the changelog for OpenSSH 9.1/9.1p1 as being fixed in that release: * ssh(1), sshd(8): SetEnv directives in ssh_config and sshd_config are now first-match-wins to match other directives. Previously if an environment variable was multiply specified the last set value would have been used. bz3438 Should it be closed?
I've just verified this with Colin's fresh openssh-client 1:9.1p1-1: When set in ssh_config as: SetEnv LC_ALL=C SetEnv LC_ALL=C.UTF-8 one now gets: setenv LC_ALL=C in -G and in -v: debug1: channel 0: setting env LC_ALL = "C" And without the following in the config: SetEnv LC_ALL=C LC_ALL=C.UTF-8 one now gets: setenv LC_ALL=C in -G and in -v: debug1: channel 0: setting env LC_ALL = "C" So I can confirm it's been fixed. I'll leave it open for now, cause maybe ssh upstream wants to add some documentation? Cheers, Chris.