cli: upgrade on Windows fails because the install script path is passed to bash with backslashes
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bash, shell, typescript
Direzione di ricerca
Esamina il codice del comando di aggiornamento, probabilmente in un modulo CLI, dove viene costruito il percorso dello script di installazione e passato a bash. La correzione prevede la conversione delle barre rovesciate di Windows in barre oblique o in un percorso POSIX prima di avviare bash. Testare eseguendo il processo di aggiornamento su Windows o simulando la conversione del percorso in un test unitario.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
On Windows, opencode upgrade (and the TUI "Update available" dialog, which uses the same path) always fails because the downloaded install script is invoked via bash with a native Windows path. Bash treats the backslashes as escape characters, so the file is never found. Updating is impossible without doing it manually.
Environment
- opencode version: 2.0.15 (reproduced upgrading 2.0.12 → 2.0.14 and 2.0.14 → 2.0.15)
- OS: Windows 11 Pro, build 26200 (Windows_NT 10.0.26200, x64)
- Terminal: reproduced from both the TUI and a plain
cmd.exe/ PowerShell shell, so it is terminal-independent - Shell:
C:\WINDOWS\system32\cmd.exe - Install/channel: curl installer (
curl -fsSL https://opencode.ai/v2/install | bash), channellatest, binary at%USERPROFILE%\.opencode\bin\opencode.exe - Active plugins: none
Reproduction
- On Windows, install OpenCode V2 with the curl installer so the binary lives at
%USERPROFILE%\.opencode\bin\opencode.exe. - Have any version that is not the latest (e.g. 2.0.12).
- Run
opencode upgrade(or accept the "Update available" dialog in the TUI). - The updater downloads the install script successfully, then fails to execute it.
Expected Behavior
OpenCode updates to the latest version.
Actual Behavior
╭ Upgrade
│
● Using method: curl
│
● From 2.0.12 → 2.0.14
│
■ Upgrade failed
│
■ /bin/bash: C:\Users\gomez\.cache\opencode\update-nikDwW\install: No such file or directory
│
╰ Failed
The same error appears in the TUI "Update available" dialog. opencode upgrade --method curl fails identically.
Additional Context
Log evidence (~/.local/share/opencode/log/opencode.log), showing the spawn of the install script:
message="spawning process" command=curl args="[\"-fsSL\",\"-o\",\"C:\\\\Users\\\\gomez\\\\.cache\\\\opencode\\\\update-H7ycBJ\\\\install\",\"https://opencode.ai/v2/install\"]" role=cli
message="spawning process" command=bash args="[\"C:\\\\Users\\\\gomez\\\\.cache\\\\opencode\\\\update-H7ycBJ\\\\install\",\"--version\",\"2.0.15\",\"--no-modify-path\"]" role=cli
Root cause
The install script path is passed to bash as a native Windows path:
bash "C:\Users\gomez\.cache\opencode\update-H7ycBJ\install" --version 2.0.15 --no-modify-path
Bash interprets the backslashes as escape characters, so the argument collapses to a single token like C:Usersgomez.cacheopencodeupdate-H7ycBJinstall, which does not exist. The download itself succeeds; only the invocation is wrong.
Suggested fix directions (one of):
- Convert the script path to a POSIX path before spawning bash (e.g.
/c/Users/gomez/.cache/opencode/update-H7ycBJ/install), or - Pass the path with forward slashes, or
- On Windows, invoke the script through a shell that understands Windows paths (Git Bash with a converted path), or
- Skip the shell-script route entirely on Windows and use the standalone zip (
https://opencode.ai/files/bin/<version>/opencode-windows-x64.zip) directly.
Frequency
Consistent — 100% reproducible across three attempts and two different version pairs.
Workaround used
Manual update, which works reliably:
- Download
https://opencode.ai/files/bin/<version>/opencode-windows-x64.zip. - Extract
opencode.exe. - Rename the currently running
opencode.exetoopencode.exe.bak(Windows permits renaming a running executable but not overwriting it). - Copy the new
opencode.exeinto%USERPROFILE%\.opencode\bin\. - Restart OpenCode.
Note: step 3 is necessary because a plain overwrite of the running binary fails on Windows, which may be a second issue to consider for the Windows update path.
- Lingua principale
- TypeScript
- Stelle
- 209k
- Fork
- 27.5k
- Merge medio
- 9h 42m
- PR unite (30g)
- 389
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di anomalyco/opencode
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Tutte le issue di anomalyco/opencode
Issue simili
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Crush Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ElementsProject/cln-application#167 · 1 commento · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Quantco/pnpm-licenses#17 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100