orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]: Generated WSL skills update command has broken escaping and drops into quote prompt

Open pnexus-wikii opened this issue 4 months ago • 3 comments

Operating system

Windows + WSL

Orca version

1.4.124

Details

A generated WSL command for updating an Orca skill appears to be escaped for an intermediate string/template layer rather than for direct shell execution. When pasted into the shell, it drops into the continuation prompt (quote>) instead of running.

This happened with the orca-cli skill update command.

Broken command shape

wsl.exe -d 'Ubuntu24-Dev' -- sh -c '_orca_wsl_shell=\$(getent passwd "\$(id -un)" 2>/dev/null | cut -d: -f7)
if [ -z "\$_orca_wsl_shell" ] || [ ! -x "\$_orca_wsl_shell" ]; then
  _orca_wsl_shell="\${SHELL:-/bin/bash}"
fi
if [ -z "\$_orca_wsl_shell" ] || [ ! -x "\$_orca_wsl_shell" ]; then
  _orca_wsl_shell=/bin/sh
fi
_orca_wsl_shell_name=\$(basename "\$_orca_wsl_shell" | tr "[:upper:]" "[:lower:]")
case "\$_orca_wsl_shell_name" in
  sh|dash) exec "\$_orca_wsl_shell" -lc ''npx skills update orca-cli --global'' ;;
  bash|zsh|ksh|mksh|ash) exec "\$_orca_wsl_shell" -ilc ''npx skills update orca-cli --global'' ;;
  *) exec /bin/sh -lc ''npx skills update orca-cli --global'' ;;
esac'

Actual behavior

The shell enters quote-continuation mode instead of executing:

quote> if [ -z "\$_orca_wsl_shell" ] || [ ! -x "\$_orca_wsl_shell" ]; then
quote>   _orca_wsl_shell="\${SHELL:-/bin/bash}"
quote> fi
...
quote> esac'

Why this looks wrong

The command contains escaped substitutions and variables inside the sh -c '...' script:

\$(...)
"\$_orca_wsl_shell"

Inside the WSL shell script those should be real shell expansions:

$(...)
"$_orca_wsl_shell"

The nested command quoting is also fragile:

''npx skills update orca-cli --global''

That can break when pasted into shells that treat the outer single-quoted sh -c '...' string literally.

Expected behavior

The generated command should be directly pasteable/runnable, or Orca should show a command with correct quoting for the current shell.

A simple working form is:

wsl.exe -d Ubuntu24-Dev -- bash -ilc 'npx skills update orca-cli --global'

If the shell-detection wrapper is required, the inner WSL script should not include backslashes before $ and should avoid nested ''...'' quoting.

Related

This is related to #6162 because it also affects npx skills update ... --global, but the failure mode here is specifically the generated Windows/WSL wrapper command being quoted/escaped incorrectly before the skill updater runs.

pnexus-wikii avatar Jul 08 '26 09:07 pnexus-wikii

Security warning for anyone reading this thread: do not download or run the ZIP attachment posted above.

I did a static-only inspection of the attachment without executing it. The ZIP contains a Windows executable, not a source patch or script:

orca_fix.zip -> orca_fix.exe
EXE SHA256: D85D164E46FABB085609F2586E8FEC364539A6EC81F74659F0CB28AC76E7880B
Size: 2,893,704 bytes
Authenticode status: UnknownError
Signer subject: CN=computrabajo.com, O=ZFQ2rJgAzWcR, L=dz6fwo, S=jNjlG5whh, C=US

The same EXE hash was also posted under different ZIP names on related issues. That pattern looks like malicious attachment spam, not an Orca fix. I deleted my local copy and recommend maintainers remove the attachment/comment.

pnexus-wikii avatar Jul 08 '26 09:07 pnexus-wikii

reviewing it now

AmethystLiang avatar Jul 12 '26 04:07 AmethystLiang

Windows + WSL Orca: 1.4.224

I switch Agent runtime to WSL and it is not working. Probably still problem with escaping " in powershell. It should be ".

Worktree scan failed for XXX Command failed: wsl.exe -d Ubuntu --exec sh -lc _orca_wsl_shell=$(getent passwd "$(id -un)" 2>/dev/null | cut -d: -f7) if [ -z "$_orca_wsl_shell" ] || [ ! -x "$_orca_wsl_shell" ]; then Existing worktrees are kept until a scan succeeds. Click the warning icon to retry.

PetrHavelka avatar Oct 10 '26 16:10 PetrHavelka