Skip to content

A path source with build_dir inside the project copies itself recursively #16

Closed

Description

@UnsignedArduino

fetch_code copies a path source with a plain shutil.copytree(path, code_path). When build_dir is inside the project folder, the copy includes build_dir, which contains the copy being written. It recurses (build/game-source/build/game-source/...) until the OS rejects the path.

Relevant code: inputs/code.py, lines 83–85.``

This is the natural layout for a local game: the config sits in the game's folder with path: "." and build_dir: build.

Reproduction (calling fetch_code.func directly):

  1. Create game/ with pxt.json and main.ts, plus game/build/.redun-cache.db, as a previous build would leave it.
  2. Call fetch_code.func('{"type": "path", "value": "<abs>/game"}', "4.0.14", "<abs>/game/build/game-source").
  3. It fails with shutil.Error listing paths like game/build/game-source/build/game-source/build/game-source/....

Even without the loop (for example, build_dir in a subfolder that copytree reaches later), the source copy would include earlier build output: each website stage carries its own node_modules, about 500 MB per game. build_binary_js then copies all of it again.

Expected behavior: a path source never copies build_dir. Either skip it in the copy (copytree(..., ignore=...), possibly also built/, node_modules/ and pxt_modules/), or reject a build_dir inside the source in resolve_config_paths with a clear error.

Found while reviewing PR #7, toolchain at ce12c48.

Activity

  1. changed the title [-][P1] A path source with build_dir inside the project copies itself recursively[/-] [+]A path source with build_dir inside the project copies itself recursively[/+] on Nov 4, 2026
  2. added
    found by claudeIssue was originally found by Claude Code. Only used for tracking.
    and removed on Nov 4, 2026
  3. UnsignedArduino commented on Nov 7, 2026

    @UnsignedArduino
    OwnerAuthor

    Prefer to reject instead of having to skip over own directory. Simpler to require users to keep it in a separate folder, expected they'll keep it next to the project directory.

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

    bugSomething isn't workingfound by claudeIssue was originally found by Claude Code. Only used for tracking.p1

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions