Skip to content

Commit 08bcabd

Browse files
foobartoclaude
andcommitted
fix(sandbox/bwrap): replace bash-only \${@:3} with POSIX shift
The launcher shell script used bash/zsh array slicing (\${@:3}), which dash (Ubuntu's /bin/sh on CI runners) rejects with "Bad substitution" and exit 2. Every sandbox/bwrap test failed because bwrap was never actually invoked. Host dev shell happened to be bash so local tests passed; CI uses dash. Switch to portable \`shift 2; exec "\$b" "\$@" < "\$p"\` — works on dash, bash, and zsh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4ef9128 commit 08bcabd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/glorbo/sandbox/bwrap.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,14 @@ defmodule Glorbo.Sandbox.Bwrap do
434434
sh_path = System.find_executable("sh") || "/bin/sh"
435435

436436
# The shell script:
437-
# exec "$1" "${@:3}" < "$2"
437+
# bwrap_bin="$1"; prompt_file="$2"; shift 2; exec "$bwrap_bin" "$@" < "$prompt_file"
438438
# - positional arg 1 = bwrap binary
439439
# - positional arg 2 = prompt file
440440
# - positional args 3+ = bwrap argv
441441
# Using `exec` makes sh replace itself with bwrap (tighter parent/child
442-
# relationship for --die-with-parent).
443-
sh_script = ~s|exec "$1" "${@:3}" < "$2"|
442+
# relationship for --die-with-parent). POSIX-only — `${@:3}` is a
443+
# bash-ism that dash (Ubuntu's /bin/sh) rejects with "Bad substitution".
444+
sh_script = ~s|b="$1"; p="$2"; shift 2; exec "$b" "$@" < "$p"|
444445

445446
port_args = [sh_script, "glorbo-bwrap-launcher", bwrap_bin, prompt_file | argv]
446447

0 commit comments

Comments
 (0)