From 57b5eb3113a96797b11233a5733ef1ebb97f886b Mon Sep 17 00:00:00 2001 From: Trey Moen <50057480+greatgitsby@users.noreply.github.com> Date: Tue, 9 Jun 2026 11:44:57 -0700 Subject: [PATCH] op.sh: fix arg quoting so special chars survive eval (#37967) op.sh: don't eval CMD, run argv directly so special chars work Previously op_run_command joined "$@" into a single string and eval'd it, which broke on inputs containing shell metacharacters. For example, 'op esim --download "LPA:1$[rsp.truphone.com]($url)$QRF-SPEEDTEST" name' would fail with a syntax error on the unquoted parens. Run "$@" instead and only use $* for the printed display string. Also quote the unquoted $@ in the other op_run_command callers. --- tools/op.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/op.sh b/tools/op.sh index 538d68956..1188d21ac 100755 --- a/tools/op.sh +++ b/tools/op.sh @@ -48,7 +48,7 @@ function retry() { } function op_run_command() { - CMD="$@" + CMD="$*" echo -e "${BOLD}Running command →${NC} $CMD │" for ((i=0; i<$((19 + ${#CMD})); i++)); do @@ -57,7 +57,7 @@ function op_run_command() { echo -e "┘\n" if [[ -z "$DRY" ]]; then - eval "$CMD" + "$@" fi } @@ -310,33 +310,33 @@ function op_build() { op_run_command system/manager/build.py else # scons is fine on PC - op_run_command scons $@ + op_run_command scons "$@" fi } function op_juggle() { op_before_cmd - op_run_command tools/plotjuggler/juggle.py $@ + op_run_command tools/plotjuggler/juggle.py "$@" } function op_lint() { op_before_cmd - op_run_command scripts/lint/lint.sh $@ + op_run_command scripts/lint/lint.sh "$@" } function op_test() { op_before_cmd - op_run_command pytest $@ + op_run_command pytest "$@" } function op_replay() { op_before_cmd - op_run_command tools/replay/replay $@ + op_run_command tools/replay/replay "$@" } function op_cabana() { op_before_cmd - op_run_command tools/cabana/cabana $@ + op_run_command tools/cabana/cabana "$@" } function op_sim() { @@ -347,7 +347,7 @@ function op_sim() { function op_clip() { op_before_cmd - op_run_command tools/clip/run.py $@ + op_run_command tools/clip/run.py "$@" } function op_switch() { @@ -489,4 +489,4 @@ function _op() { esac } -_op $@ +_op "$@"