Skip to content

replay.py: an empty env value emitted a SyntaxError, breaking every replay script - #258

Merged
devdanzin merged 1 commit into
mainfrom
replay-empty-env-value
Aug 18, 2026
Merged

replay.py: an empty env value emitted a SyntaxError, breaking every replay script#258
devdanzin merged 1 commit into
mainfrom
replay-empty-env-value

Conversation

@devdanzin

Copy link
Copy Markdown
Owner

Found while triaging a PyPy fleet — I went to run a crash dir's replay.py and it wouldn't parse.

The bug

formatPath() builds its result by appending pieces and then joins them. For an empty
value
nothing is ever appended, so it returns "" and the env-dict emitter writes:

env = {
    "DEBUGINFOD_URLS": ,
}

SyntaxError.

Why it matters more than it looks

fusil sets DEBUGINFOD_URLS="" in every target child (the llvm-symbolizer workaround,
fusil/python/__init__.py:791), so the empty value is the common case, not an edge case.

Measured across the existing runs under /home/fusil/runs: 60 of 60 sampled replay.py
files fail to parse — apsw, OOM, TSan, PyPy alike.

replay.py is the primary triage artifact — the thing a human runs to reproduce a kept crash
outside the fuzzer. The failure is silent: the crash dir looks complete, and nothing surfaces
until someone actually tries to replay it, possibly long after the run.

Tests

The existing test_generated_script_is_valid_python could not catch this — its fixture env
has no empty values. Added three tests to tests/test_replay_python.py (kept alongside the
existing 34, not replacing them), verified to fail without the fix:

  • test_empty_str_is_a_valid_expression / test_empty_bytes_is_a_valid_expression
  • test_env_dict_with_empty_value_is_parseable — execs the emitted env block

Verified end-to-end on a fresh PyPy crash dir: replay.py now parses and replay.py --help
runs. Full suite green (1252); ruff clean.

🤖 Generated with Claude Code

…eplay script

formatPath() builds its result by appending pieces, then joins them. For an empty value
nothing is ever appended, so it returned "" and the env-dict emitter wrote

    "DEBUGINFOD_URLS": ,

which is a SyntaxError. fusil sets DEBUGINFOD_URLS="" in EVERY target child (the
llvm-symbolizer workaround, __init__.py:791), so this is the common case, not an edge
case: measured across the existing runs under /home/fusil/runs, 60 of 60 sampled
replay.py files fail to parse.

replay.py is the primary triage artifact -- the thing a human runs to reproduce a kept
crash outside the fuzzer -- and the failure is silent: the crash dir looks complete and
nothing surfaces until someone tries to replay it, possibly months later.

The existing end-to-end test (test_generated_script_is_valid_python) could not catch this
because its fixture env has no empty values, so the added tests assert on formatPath
directly and exec the emitted env block.

Verified on a fresh PyPy crash dir: replay.py now parses and `replay.py --help` runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WhcpLoyjUWLbETGZnA9boj
@devdanzin
devdanzin merged commit dc70f0e into main Aug 18, 2026
1 of 2 checks passed
@devdanzin
devdanzin deleted the replay-empty-env-value branch August 18, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant