Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(e2e): pass the re-exec'd test binary as a shell parameter, not inside quotes\n\nCodeRabbit and Codex both flagged the same thing independently: the child\nre-exec interpolated `exe.display()` between literal single quotes, so a\nrepository or CARGO_TARGET_DIR whose path contains `'` closes the literal\nearly and hands `sh` invalid syntax. The test would then fail before its\nchild ever ran.\n\nThe exe and the test name are now positional parameters (`$1`, `$2`) with `sh`\nin the conventional `$0` slot, so the shell never parses either as syntax.\n\nVerified both ways under a real `/home/o'connor/...` path:\n old form -> `sh: -c: line 0: unexpected EOF while looking for matching "'"`\n new form -> the child runs and receives its arguments intact\n\nNo assertion changed and nothing was skipped — this only fixes how the\nexisting child is launched.\n

M3gA-Mind6f851e651962
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index d855845d62..d987dc4266 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -14235,13 +14235,20 @@ async fn auth_store_provider_credentials_writes_an_owner_only_store_file() {
// security regression test would go green having checked nothing.
if std::env::var(OWNER_ONLY_CHILD_ENV).is_err() {
let exe = std::env::current_exe().expect("current_exe");
+ // The exe path and the test name go in as POSITIONAL PARAMETERS rather
+ // than interpolated into the command string. A repository or
+ // CARGO_TARGET_DIR containing a single quote (`/home/o'connor/openhuman`)
+ // would close the literal `'...'` early and hand `sh` invalid syntax, so
+ // this test would fail before its child ever started — on exactly the
+ // machines whose paths are least likely to be noticed. `$0` is the
+ // conventional placeholder slot for `sh -c`, so the real arguments start
+ // at `$1`.
let status = std::process::Command::new("sh")
.arg("-c")
- .arg(format!(
- "umask 022 && exec '{}' --exact {} --nocapture --test-threads=1",
- exe.display(),
- OWNER_ONLY_TEST_NAME
- ))
+ .arg("umask 022 && exec \"$1\" --exact \"$2\" --nocapture --test-threads=1")
+ .arg("sh")
+ .arg(&exe)
+ .arg(OWNER_ONLY_TEST_NAME)
.env(OWNER_ONLY_CHILD_ENV, "1")
.status()
.expect("re-exec the owner-only test under umask 022");