Skip to content

Commit 5220d21

Browse files
fix(consume): fix consume_direct.sh by quoting the testid passed to --filter (#1987)
Co-authored-by: danceratopz <[email protected]>
1 parent bf67cb7 commit 5220d21

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Users can select any of the artifacts depending on their testing needs for their
8989

9090
- ✨ Add `--extract-to` parameter to `consume cache` command for direct fixture extraction to specified directory, replacing the need for separate download scripts. ([#1861](https://github.com/ethereum/execution-spec-tests/pull/1861)).
9191
- 🐞 Fix `consume cache --cache-folder` parameter being ignored, now properly caches fixtures in the specified directory instead of always using the default system cache location.
92+
- 🐞 Fix the `consume_direct.sh` script generated by `consume` in the `--evm-dump` dir by quoting test IDs [#1987](https://github.com/ethereum/execution-spec-tests/pull/1987).
9293
- 🔀 `consume` now automatically avoids GitHub API calls when using direct release URLs (better for CI environments), while release specifiers like `stable@latest` continue to use the API for version resolution ([#1788](https://github.com/ethereum/execution-spec-tests/pull/1788)).
9394
- 🔀 Refactor consume simulator architecture to use explicit pytest plugin structure with forward-looking architecture ([#1801](https://github.com/ethereum/execution-spec-tests/pull/1801)).
9495
- 🔀 Add exponential retry logic to initial fcu within consume engine ([#1815](https://github.com/ethereum/execution-spec-tests/pull/1815)).

src/ethereum_clis/clis/geth.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import json
44
import re
5+
import shlex
56
import shutil
67
import subprocess
78
import textwrap
@@ -125,8 +126,19 @@ def _consume_debug_dump(
125126
fixture_path: Path,
126127
debug_output_path: Path,
127128
):
128-
debug_fixture_path = debug_output_path / "fixtures.json"
129-
consume_direct_call = " ".join(command[:-1]) + f" {debug_fixture_path}"
129+
# our assumption is that each command element is a string
130+
assert all(isinstance(x, str) for x in command), (
131+
f"Not all elements of 'command' list are strings: {command}"
132+
)
133+
assert len(command) > 0
134+
135+
# replace last value with debug fixture path
136+
debug_fixture_path = str(debug_output_path / "fixtures.json")
137+
command[-1] = debug_fixture_path
138+
139+
# ensure that flags with spaces are wrapped in double-quotes
140+
consume_direct_call = " ".join(shlex.quote(arg) for arg in command)
141+
130142
consume_direct_script = textwrap.dedent(
131143
f"""\
132144
#!/bin/bash

src/ethereum_clis/clis/nethermind.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import json
44
import re
5+
import shlex
56
import subprocess
67
import textwrap
78
from functools import cache
@@ -55,13 +56,21 @@ def _consume_debug_dump(
5556
result: subprocess.CompletedProcess,
5657
debug_output_path: Path,
5758
):
58-
consume_direct_call = " ".join(command)
59+
# our assumption is that each command element is a string
60+
assert all(isinstance(x, str) for x in command), (
61+
f"Not all elements of 'command' list are strings: {command}"
62+
)
63+
64+
# ensure that flags with spaces are wrapped in double-quotes
65+
consume_direct_call = " ".join(shlex.quote(arg) for arg in command)
66+
5967
consume_direct_script = textwrap.dedent(
6068
f"""\
6169
#!/bin/bash
6270
{consume_direct_call}
6371
"""
6472
)
73+
6574
dump_files_to_directory(
6675
str(debug_output_path),
6776
{

0 commit comments

Comments
 (0)