Skip to content

with build inside a project under the repo evaluates the enclosing repo's build.w graph #1082

Closed

Description

@ehartford

What happens

A with build run inside a project directory that sits under the enclosing repo (a with.toml project created by a test under out/tmp/<case>) evaluates the enclosing repo's build.w graph instead of the project's own. The fixture test/behavior/behav_project_overflow_modes.w creates such a project and runs with build <pkg> --no-deps in it through pre_d_build_runner.w's p7_run; the nested build's output is the compiler graph:

stdout:
embedded 36 clang builtin headers (resource v22)
stderr:
[time] compat-runtime-source 0.1s
[time] embedded-clang-resource-source 0.1s
...
[time] bootstrap-embedded-objects-object 0.0s
error: build.w target failed: with-sha256
[build] :build wall 1.0s
panic at test/behavior/lib/pre_d_build_runner.w:126:5: assertion failed

with-sha256, compat-runtime-source, bootstrap-* are C:/src/with/build.w targets, not the case project's. Observed on native Windows with main at 54fd9052 (fix-1081-str-from-cstr) under the tree's own release compiler; the case directory has its own with.toml and no build.w.

Why it is invisible on unix

The repo graph is fully cached inside the test, so every target is a no-op and with-sha256's relink goes through cc, which needs nothing from the environment. On Windows that relink needs the lld metadata or the WITH_LLVM_LD / LLVM_LD / LLVM_PREFIX fallback (#1075), and the worker that runs it has neither (see the companion issue on worker environment). The fixture is therefore red on native Windows and green everywhere else — for the wrong reason on both.

Expected

Project root and build.w resolution stop at the nearest with.toml; a project under out/tmp of the repo builds only itself. The fixture should not touch the compiler graph at all.

Route

with build in a scratch project under the repo, --dump-project-info (or the driver's project-root resolution) to see which root and build.w it picks. Found while closing #1081 on the native Windows box; details in fix_windows.md ("The :test battery on this box").

Activity

  1. ehartford commented on Sep 7, 2026

    @ehartford
    ContributorAuthor

    Corrected diagnosis (reporter): the nested build did not walk up to the repo's build.w — its cwd was right; it trusted an inherited PWD (/c/src/with from git-bash / the parent's directory), which the driver reads for its working directory, and rooted there. Replay with PWD=/c/src/with reproduces it exactly. Fix: #1091 (Windows runtime owns PWD at startup and for spawned children). Same PR fixes the with.toml lookup for drive paths, the reason the fixture's overflow mode was lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions