Skip to content

op.sh: fix arg quoting so special chars survive eval#37967

Open
greatgitsby wants to merge 1 commit intocommaai:masterfrom
greatgitsby:op-sh-fix-arg-quoting
Open

op.sh: fix arg quoting so special chars survive eval#37967
greatgitsby wants to merge 1 commit intocommaai:masterfrom
greatgitsby:op-sh-fix-arg-quoting

Conversation

@greatgitsby
Copy link
Copy Markdown
Contributor

@greatgitsby greatgitsby commented May 5, 2026

shell-relevant characters like $ break with current parse logic, this makes it more robust.

before

comma@comma-5e84b88:/data/openpilot$ tools/op.sh esim --download 'LPA:1$rsp.truphone.com$QRF-SPEEDTEST' TEST
Checking system → [✔]
Running command → system/hardware/esim.py --download LPA:1$rsp.truphone.com$QRF-SPEEDTEST TEST │
───────────────────────────────────────────────────────────────────────────────────────────────┘

Traceback (most recent call last):
  File "/data/openpilot/system/hardware/esim.py", line 26, in <module>
    lpa.download_profile(args.download[0], args.download[1])
  File "/data/pythonpath/openpilot/system/hardware/tici/lpa.py", line 749, in download_profile
    iccid = download_profile(self._client, qr)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/pythonpath/openpilot/system/hardware/tici/lpa.py", line 641, in download_profile
    smdp, matching_id = parse_lpa_activation_code(activation_code)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/pythonpath/openpilot/system/hardware/tici/lpa.py", line 617, in parse_lpa_activation_code
    raise ValueError("Invalid activation code format")
ValueError: Invalid activation code format

after

comma@comma-5e84b88:/data/openpilot$ tools/op.sh esim --download 'LPA:1$rsp.truphone.com$QRF-SPEEDTEST' TEST
Checking system → [✔]
Running command → system/hardware/esim.py --download LPA:1$rsp.truphone.com$QRF-SPEEDTEST TEST │
───────────────────────────────────────────────────────────────────────────────────────────────┘

Traceback (most recent call last):
  File "/data/openpilot/system/hardware/esim.py", line 26, in <module>
    lpa.download_profile(args.download[0], args.download[1])
  File "/data/pythonpath/openpilot/system/hardware/tici/lpa.py", line 749, in download_profile
    iccid = download_profile(self._client, qr)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/pythonpath/openpilot/system/hardware/tici/lpa.py", line 675, in download_profile
    load_bpp(client, _b64_field(bpp, "boundProfilePackage"))
  File "/data/pythonpath/openpilot/system/hardware/tici/lpa.py", line 592, in load_bpp
    raise RuntimeError(msg)
RuntimeError: Profile installation failed. The QR code may have already been used.

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.
@github-actions github-actions Bot added the tools label May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Process replay diff report

Replays driving segments through this PR and compares the behavior to master.
Please review any changes carefully to ensure they are expected.

✅ 0 changed, 66 passed, 0 errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant