Skip to content

perry-ext-zlib is missing deflateRawSync/inflateRawSync, so the node:zlib flip breaks the link (test_gap_zlib_4917_level) #8005

Description

@proggeramlug

test_gap_zlib_4917_level fails to link on the auto-optimize path — which is the path
./scripts/run_gap_tests.sh uses by default — with:

Undefined symbols for architecture arm64:
  "_js_zlib_deflate_raw_sync", referenced from: _main
  "_js_zlib_inflate_raw_sync", referenced from: _main

Why

js_zlib_deflate_raw_sync and js_zlib_inflate_raw_sync are defined in exactly one place:

crates/perry-stdlib/src/zlib.rs:288  pub unsafe extern "C" fn js_zlib_deflate_raw_sync(...)
crates/perry-stdlib/src/zlib.rs:303  pub unsafe extern "C" fn js_zlib_inflate_raw_sync(...)

perry-ext-zlib does not define them. When the well-known flip routes node:zlib to
perry-ext-zlib, optimized_libs/driver.rs strips compression-gzip from the stdlib
rebuild, on the stated grounds that

The ext crate carries all codecs, so nothing is lost by dropping them here.

That is true for the codecs and false for the raw one-shot entry points, so the two
symbols disappear from the link entirely.

Verified both ways, same tree, same archives (55fd197d5 + PR #7999)

path result
PERRY_NO_AUTO_OPTIMIZE=1 (full prebuilt stdlib supplies them) links, exit 0
auto-optimize (stdlib rebuilt without compression-gzip) link fails, 2 undefined symbols

The test is zlib.deflateRawSync(data, { level })test-files/test_gap_zlib_4917_level.ts
lines 11-13.

Why it has been invisible

It is not in test-parity/gap_snapshot.json, and the required gap shards run on
ubuntu-latest. It surfaced while validating #7629, whose fix routes ext-importing gap
tests through auto-optimize per test — the first configuration in which this test's
auto-optimize link was exercised by the harness. #7999 deliberately does not route
around it (dropping zlib from the ext-routed module set would hide a real API gap to make
a number green).

Fix direction

Implement deflateRawSync / inflateRawSync in perry-ext-zlib so the flip's premise
holds, and add an assertion that the ext crate's exported js_zlib_* surface is a superset
of the stdlib feature the flip strips — the premise is stated in a comment today and nothing
checks it, which is how a missing pair of entry points became a link error two stages
downstream.

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