Skip to content

Resolve corpus compiler paths before changing the working directory #808

Closed

Description

@LunaStev

Problem

An explicit relative compiler path is validated in the caller directory but returned unchanged. Compilation later runs with cwd=ROOT; a valid ./fake-wavec becomes a bare fake-wavec executable name and cannot be launched. A compiler with that name on PATH could also be selected instead.

Starting points: tools/check_wave_corpus.py.

Reproduction

Executed on Linux amd64 with Python 3.14.7. The affected files at local ade878134519b0f957ca28a23c6f9cd98e43dff3 are byte-identical to canonical master 286dad9c8fcb0616f7c719c72cbf453a7d9925fd.

Run from the repository root:

python3 -B - <<'PYREPRO'
import os, tempfile
from pathlib import Path
from unittest.mock import patch
from tools import check_wave_corpus as c
with tempfile.TemporaryDirectory() as tmp:
    p = Path(tmp) / 'fake-wavec'
    p.write_text('#!/bin/sh\nexit 0\n')
    p.chmod(0o700)
    os.chdir(tmp)
    with patch.object(c, 'corpus_files', return_value=[c.ROOT / 'examples/std/net_tcp.wave']):
        c.main(['--wavec', './fake-wavec'])
PYREPRO

Observed: FileNotFoundError: [Errno 2] No such file or directory: fake-wavec. The provided executable exists and is executable.

Scope

Easy: make successfully resolved executable paths stable across the child working-directory change, including the WAVEC override. Keep explicit-selection precedence.

Completion criteria

  • A caller-relative executable runs from outside the repository.
  • Explicit paths cannot silently fall back to a same-named PATH executable.
  • Cover relative paths containing spaces and WAVEC selection.

Activity

  1. added
    bugA problem that causes incorrect behavior or crashes.
    good first issueIssues that are good for newcomers or first-time contributors.
    needs testingIssues that require additional testing or verification.
    on Sep 29, 2026
  2. self-assigned this
    on Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugA problem that causes incorrect behavior or crashes.good first issueIssues that are good for newcomers or first-time contributors.needs testingIssues that require additional testing or verification.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions