Skip to content

with get shells out to host curl/wget — must be runtime-native fetch #623

Closed

Description

@ehartford

Summary

with get (build-graph fetch) invokes HOST curl (src/BuildGraphTools.w:41 defines the curl tool; ComptimeEval.w:1681 whitelists curl/wget/https_fetch). The compiler's own tooling depending on a host binary is the same violation class as the removed cc -E shell-out (#348): breaks on clean hosts, violates the no-external-commands invariant (AGENTS.md), and contradicts §16.1/§18 self-containedness. (The ComptimeEval tool whitelist is fine for USER build.w scripts — the violation is with get, compiler tooling, using it for its own operation.)

WWED

Fetch must be runtime-native: HTTPS through With runtime syscalls (pure-With TLS is a big lift, so staged: (a) short-term, a vendored/runtime https_fetch implemented in With over the socket runtime + platform TLS via extern fn bindings to Security.framework/openssl-the-system-lib is still a library BINDING, not a subprocess — bindings are the sanctioned mechanism, subprocesses are not; (b) document the boundary). Zero non-With code invariant applies to any implementation.

Found

2026-07-03 while explaining a 28-minute gate run: live curl inside cli-selfhost-project-tests.

Activity

  1. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    Correction from Eric + verification — this is simpler and worse than filed: With already has its own fetch stack (lib/std/http.w — HTTP/1.1 over std.tls; the build system even compiles a native https_fetch tool from build/https_fetch.w via lib/std/build.w:2007). So the curl/wget path in BuildGraphTools isn't a missing-capability workaround — it's a redundant host-tool dependency sitting NEXT to the native implementation. WWED revision: with get uses the native fetch unconditionally; DELETE the curl/wget tool definitions and the ComptimeEval whitelist entries for the compiler's own operations (no fallback — a second engine that can disagree, per the #348 precedent). Observed on this host: live curl ran during the gate suite, so the host-tool path is the one actually taken.

  2. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    Exact mechanism found (answers 'why curl'): src/compiler/ConanClient.w:33-60 — the with get c.* client has a private conan_curl_to_file building a host-curl argv via runtime_exec_argv_capture, plus conan_extract_tgz* shelling out to host tar. It's a THIRD fetch path that predates the native stack and never migrated: lib/std/http.w (HTTP/1.1 over std.tls) exists, and build.w's download action already compiles-and-runs the native https_fetch helper (lib/std/build.w:2062+) — ConanClient just doesn't use either. Drift, not design.

    WWED (revised fix plan): port ConanClient to the native stack — fetch via std.http (or the same https_fetch helper build.w uses), gzip via lib/std/zlib.w (already in the stdlib), plus a small tar reader in With (ustar parsing is ~100 lines); DELETE conan_curl_to_file, the tar argv helpers, and the now-unused build_graph_curl_tool/whitelist entries. No fallback — one engine (the #348 rule).

  3. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    Full path mapped; reverted the in-progress attempt to keep the tree clean. The correct fix is bootstrap-phased — this is why it can't land in one cycle.

    WWED confirmed by Eric: use std.zlib, not a second inflater. An implementation attempt (native std.http fetch + a compiler-private buffer-based tar reader + std.zlib for gzip) works end-to-end — verified downloading and extracting a real zlib/1.3.1 package from center2.conan.io byte-identically to host tar — BUT hits a hard bootstrap-ordering wall:

    1. use std.zlib cannot enter compiler code today because lib/std/zlib/defs.w exports pub type code (an internal Huffman-table struct) which, when imported, shadows same-named locals in value position — including src/main.w:518 code.len(). (That shadowing is itself a general bug — filed Imported type name shadows a same-named local in value/receiver position (should be a value-namespace lookup) #628; fixing it removes the need for any rename.)
    2. Renaming zlib's internal code→zhuff (698 type-position replacements across the 6 zlib files) clears the collision — BUT the release binary EMBEDS the stdlib, and each build STAGE compiles compiler code against the CURRENT stage's embedded stdlib. So a with build that adds use std.zlib to Tar.w still sees the OLD embedded code and fails. Classic runtime-migration bootstrap: the stdlib rename (or Imported type name shadows a same-named local in value/receiver position (should be a value-namespace lookup) #628) must ship in a SEED first; only then can compiler code use std.zlib. (CLAUDE.md 'Bootstrap order for runtime migration'.)

    Recommended sequencing for a focused session:

    • Option A (cleanest): fix Imported type name shadows a same-named local in value/receiver position (should be a value-namespace lookup) #628 (local shadows imported type in value position) → bootstrap a seed with it → then compiler code can use std.zlib directly, no rename.
    • Option B: Phase-1 commit renames zlib code→zhuff (stdlib-only) + bootstrap seed; Phase-2 commit adds use std.zlib to a new src/compiler/Tar.w + rewires ConanClient off curl/tar.
    • The tar layer (buffer-based ustar+pax+GNU-longname reader, verified against real Conan pax archives) is salvageable either way — it needs no rename.

    Residuals for this issue's scope: conan_compile_c_source still shells to $CC (needs a C compiler for source-fallback builds — separate question); std.http has no connect/read timeouts (a hung server hangs with get).

  4. added 2 commits that reference this issue on Jul 4, 2026
  5. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): still reproduces. The fetch tool is host curl:

    src/BuildGraphTools.w:39: fn build_graph_curl_tool() -> BuildTool:
    src/BuildGraphTools.w:40:     build_graph_tool("curl", "CURL", "curl")
    

    post-release: the native fetch is bootstrap-phased (the last comment maps it: std.http over std.zlib, landing across a seed cut); every supported host ships curl today.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions