From 1243e148d455cd83f18b66f70bcfe2b8a4b746c9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 4 Oct 2026 07:08:19 +0200 Subject: [PATCH] Quote instrumentation agent paths with spaces --- tools/test_quad_sizes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/test_quad_sizes.py b/tools/test_quad_sizes.py index 507a42abf..485f5af6f 100644 --- a/tools/test_quad_sizes.py +++ b/tools/test_quad_sizes.py @@ -54,7 +54,9 @@ def main(): (instance / "config/horizon-quad-reuse.properties").write_text(f"enabled={str(enabled).lower()}\n") environment = os.environ.copy() header_option = "-XX:" + ("+" if headers else "-") + "UseCompactObjectHeaders" - environment["_JAVA_OPTIONS"] = f"-javaagent:{agent} {header_option} -Dhorizon.fixture.exit=true" + if '"' in str(agent) or "\n" in str(agent): + raise ValueError("Instrumentation agent path contains an unsupported quote or newline") + environment["_JAVA_OPTIONS"] = f'-javaagent:"{agent}" {header_option} -Dhorizon.fixture.exit=true' command = [sys.executable, str(root / "tools/runtime.py"), "demo", "--instance", str(instance), "--heap", "3G"] if platform.system() == "Linux" and not args.native_display: command = ["xvfb-run", "-a", *command]