Skip to content

PCRE2 repo test drivers test/pcre2_smoke.w and pcre2_verify.w do not compile (the Linux link is fixed) #1071

Closed

Description

@eas4ai

Restated 2026-10-25. The Linux link failure (undefined __stdinp/__stdoutp/__stderrp) is fixed: the Linux runtime defines them. What is left: the repo-side PCRE2 drivers test/pcre2_smoke.w and test/pcre2_verify.w do not compile on any platform.


Original report

At 450733e, the PCRE2 port's own test path does not run on Linux (verified with the seed; check is clean, so the port typechecks — this is harness/platform, not port logic):

  1. lib/std/re/pcre2test.w does not link on Linux:
$ out/bootstrap/bin/with-stage1 build lib/std/re/pcre2test.w -o /tmp/pcre2test
ld.lld: error: undefined symbol: __stderrp
ld.lld: error: undefined symbol: __stdoutp
ld.lld: error: undefined symbol: __stdinp
error: build failed

Root cause observed: these globals are declared extern in lib/std/libc.w:13-15 but defined only in rt/darwin_aarch64.w:55-57,93-99 — no Linux definition. So the upstream-derived test driver (and any probe touching extend_inputline/c_option/display_properties) cannot build on Linux.

  1. The repo-side tests are stale vs current safety rules (with run test/pcre2_smoke.w → rc=1):
error: unsafe function call requires unsafe context   (smoke :118-119, :142-143; verify likewise)
error: `&mut` is not part of safe With (§15.1)         (sanity_check :20)

Net effect: on Linux there is currently no runnable PCRE2 test (neither the upstream driver nor the repo smoke/verify/sanity tests), only check-clean. The live equivalent per the audit is the build-system workspace.compile() path (build/pcre2.w:767).

Evidence: .audit/modules/lib__std__re__pcre2test.w.md, .audit/modules/lib__std__re__{bundle,pcre2posix}.w.md

Activity

  1. ehartford commented on Sep 16, 2026

    @ehartford
    Contributor

    Review: reproduced (claim 1 fixed after filing; claim 2 still live)

    Verdict. Both claims were real at the reported revision 450733e. Claim 1 (the pcre2test.w Linux link failure from undefined __stdinp/__stdoutp/__stderrp) is fixed on current main: the Linux runtime now defines those globals. Claim 2 (the repo-side test/pcre2_*.w tests are stale) is still live on main: pcre2_smoke.w and pcre2_verify.w fail to compile with unsafe function call requires unsafe context. Net today: on Linux the link blocker is gone, but there is still no runnable repo PCRE2 test because the smoke/verify drivers do not compile on any platform.

    Tested.

    Reported revision source at 450733e; compiler built from 450733e (nightly-20260903 seed)
    Current main with v0.15.2.1 built from 5809ac1 (staging worktree)
    Platform macOS Darwin 25.6.0 arm64 (no Linux host — claim 1's link is source-verified, not re-run)

    Claim 1 — fixed after filing. At 450733e, rt/linux_x86_64.w had no __stdinp definition (grep count 0), so a Linux link of anything referencing those Darwin stdio globals failed as the report shows. Commit b0d06da ("rt: define Darwin stdio globals on non-Darwin backends", 2026-09-04, one day after 450733e) and 72e7355 (Windows) added them: rt/linux_x86_64.w:55-57 now has pub var __stdinp/__stdoutp/__stderrp initialized at :78-80 (same for rt/linux_aarch64.w, rt/windows_x86_64.w). So the undefined-symbol link error is resolved on main. I could not re-run the Linux link (no host); this rests on the source diff plus the report's Linux run at 450733e.

    Claim 2 — still live on main. with run on the repo drivers, HEAD:

    • test/pcre2_smoke.w: error: unsafe function call requires unsafe context (multiple sites, matching the reported :118-119/:142-143).
    • test/pcre2_verify.w: same unsafe function call requires unsafe context.
    • test/pcre2_sanity_check.w: fails, but on HEAD the first error is unknown type 'pcre2_real_general_context_8', not the &mut at :20 the report cited — so either the &mut was already addressed or a type-resolution error now dominates. The file still does not run.

    So the drivers are stale against current safety rules (an unsafe fn call needs an unsafe context), same drift class as #1063/#1069. with check is clean, so the port itself typechecks; this is harness rot, not port logic.

    Root cause. Claim 1: a platform gap in the runtime (Darwin-only stdio globals), fixed. Claim 2: test drivers predating the unsafe-context rule for unsafe fn calls. No port-logic defect.

    Severity. Medium historically (no runnable PCRE2 test on Linux at 450733e); now reduced to "repo PCRE2 smoke/verify tests do not compile," which is why the live coverage is the build-system workspace.compile() path (build/pcre2.w), as the report notes.

    Related. #1063/#1069 (stale-test/tool wave). b0d06da/72e73552 fixed claim 1. No open PR for the stale drivers.

    Recommendation — champion the driver migration. Wrap the unsafe fn calls in test/pcre2_smoke.w/pcre2_verify.w/pcre2_sanity_check.w in unsafe { ... } (and resolve the pcre2_real_general_context_8 type reference in sanity_check), then wire one of them into a test lane so there is a runnable repo PCRE2 test on all platforms. Acceptance criteria: the three drivers run to completion; a Linux CI lane links and runs at least the smoke test (now that the stdio globals exist).

    Blockers / not tested. No Linux host, so claim 1's link was not independently re-run; it is source-verified fixed and was reproduced by the reporter at 450733e. The stale-driver failures are reproduced on macOS.

  2. changed the title [-]PCRE2 test path broken on Linux: pcre2test.w unlinkable (__stdinp/__stdoutp/__stderrp), test/pcre2_*.w stale[/-] [+]PCRE2 repo test drivers test/pcre2_smoke.w and pcre2_verify.w do not compile (the Linux link is fixed)[/+] on Oct 25, 2026
  3. ehartford commented on Oct 25, 2026

    @ehartford
    Contributor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced for the drivers.

    $ with check test/pcre2_smoke.w
    error: unsafe function call requires unsafe context
    $ with check test/pcre2_verify.w
    error: unsafe function call requires unsafe context
    

    post-release: stale test drivers; the corpus has its own upstream RunTest lane.

  4. added this to the post-v0.16.0 milestone on Oct 28, 2026
  5. added a commit that references this issue on Nov 11, 2026
  6. ehartford commented on Nov 11, 2026

    @ehartford
    Contributor

    Fixed in #3255 (6a905fd): the three stale drivers test/pcre2_smoke.w, pcre2_verify.w and pcre2_sanity_check.w are deleted; std.regex's own tests cover the engine. Battery green on the stack.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions