Skip to content

Strip LC_* before mosh ssh handshake#905

Merged
binaricat merged 1 commit into
mainfrom
fix/mosh-strip-lc-env
May 6, 2026
Merged

Strip LC_* before mosh ssh handshake#905
binaricat merged 1 commit into
mainfrom
fix/mosh-strip-lc-env

Conversation

@binaricat
Copy link
Copy Markdown
Owner

@binaricat binaricat commented May 6, 2026

Summary

  • macOS Terminal/iTerm export LC_CTYPE=UTF-8 (a bare value, not a real locale name). System ssh_config has SendEnv LC_*, so when netcatty spawns the system ssh for mosh handshake, that value leaks to the remote and every login prints:
    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
  • Tried -o "SendEnv -LC_*" first but OpenSSH processes -o before the system config, so the - removal happens against an empty list and the system SendEnv LC_* re-adds it.
  • Fix: scrub all LC_* keys from the env passed to the spawned ssh child in `startMoshSessionViaHandshake`. mosh-server already sets the locale it needs via the `LC_ALL=...` prefix.

Test plan

  • mosh-connect to a Debian/Ubuntu host that does not have `UTF-8` (or `en_US.UTF-8`) locale generated; confirm bash no longer prints the `setlocale` warning at login.
  • Confirm UTF-8 characters render correctly in the mosh session (Chinese filenames, emoji, etc).
  • `node --test electron/bridges/moshHandshake.test.cjs` still passes.

🤖 Generated with Claude Code

macOS Terminal/iTerm export LC_CTYPE=UTF-8 (a bare value, not a real
locale name). The system ssh_config has SendEnv LC_*, so the value
leaks to the remote and bash warns "cannot change locale (UTF-8)" on
every login. mosh-server sets its own locale separately, so dropping
LC_* from the spawned ssh's env is the cleanest fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@binaricat binaricat merged commit 43097c4 into main May 6, 2026
16 checks passed
@binaricat binaricat deleted the fix/mosh-strip-lc-env branch May 10, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant