Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Bug: SSH connection fails when targeting Windows host due to hardcoded 'sh' wrapper (corrupted CP949 error `'sh'() Ǵ...`)

Aperta
#3,427 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
go

Direzione di ricerca

Start in pkg/remote/connutil.go at GetClientPlatform and pkg/genconn/genconn.go at BuildShellCommand, then reproduce wsh conn reinstall against a Windows OpenSSH target. Trace how uname -sm becomes sh -c and how the resulting Windows error is decoded. Done means platform detection no longer fails because sh is unavailable and the reported error is readable.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

When attempting to connect or reinstall a connection (wsh conn reinstall) to a remote target that runs on Windows OS (with native OpenSSH server enabled), the process fails during client platform detection. The terminal prints a corrupted, unreadable error message:

Error: reinstalling connection: error detecting client platform: error running uname -sm: Process exited with status 1, stderr: 'sh'()  Ǵ  ,     α, Ǵ ġ  ƴմϴ.
Root Cause Analysis
  1. Decoding Error (CP949 to UTF-8)
    The unreadable message 'sh'() Ǵ , α, Ǵ ġ ƴմϴ. is the CP949-encoded Windows Command Prompt/PowerShell error message decoded as UTF-8 in Go. The original Korean error message is:
    'sh'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다.
    (English translation: 'sh' is not recognized as an internal or external command, operable program or batch file.)

  2. Hardcoded sh -c wrapper
    In the Go source code, when detecting the platform of the remote machine:

  • In pkg/remote/connutil.go inside GetClientPlatform, uname -sm is run to determine the target OS and architecture.

  • However, in pkg/genconn/genconn.go inside BuildShellCommand, all remote shell commands are wrapped in sh -c by default:

    return fmt.Sprintf("sh -c %s", shellutil.HardQuote(envVars.String()+shellCmd)), nil
    
  • Since a Windows host does not have sh installed in its %PATH% by default, executing sh -c 'uname -sm' fails immediately with the Windows command-not-found error.

Environment
  • Client OS: Windows/Linux/macOS
  • Remote Target OS: Windows (running OpenSSH)
  • Wave Terminal / wsh version: v0.14.5
Suggested Mitigation / Fixes
  • Detection fallback: If sh fails or is missing, try executing commands via cmd.exe /c or powershell -Command when targeting Windows hosts, or allow specifying the shell/OS configuration beforehand.
  • Graceful parsing: Handle different shell error codes and decoding errors (like CP949 fallback for Windows targets) to show friendly messages when the shell invocation fails.
Lingua principale
Go
Stelle
22.3k
Fork
1.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wavetermdev/waveterm

Tutte le issue di wavetermdev/waveterm

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.