Skip to content
This repository was archived by the owner on Jul 21, 2026. It is now read-only.

bc: add arbitrary-precision calculator tools - #28

Open
brandonpayton wants to merge 5 commits into
mainfrom
migrate/bc-cli
Open

bc: add arbitrary-precision calculator tools#28
brandonpayton wants to merge 5 commits into
mainfrom
migrate/bc-cli

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jul 11, 2026

Copy link
Copy Markdown
Member

Why

Kandelo users and scripts need arbitrary-precision arithmetic without depending
on the package registry that Homebrew is replacing. The tap does not yet build
the complete GNU calculator command surface from source. Migrating both bc
and dc matters because it proves their normal calculations and dc child
command behavior through Kandelo's supported Homebrew and process paths.

What changed

  • Build the verified official source through Kandelo's SDK/configure/sysroot path.
  • Declare Texinfo as a host-only documentation dependency and install both executables, manpages, and Info manuals through upstream make install.
  • Disable undeclared libedit/readline integration.
  • Preserve dc shell escapes and their native Kandelo posix_spawn behavior.
  • Declare Binaryen and WABT, then validate both final programs as fork: :forbidden through the merged tap artifact contract.
  • Test exact versions, arbitrary-precision exponentiation/division, and a real dc child command.

Neither executable should import kernel.kernel_fork or carry fork-continuation exports; process creation lowers through posix_spawn, so adding fork instrumentation would be incorrect.

Current exact head

This branch is based directly on tap main c5705667a90b05754d2244a362f3f7fc95d2f9c3.

Head: 7d2091c23fb628c3de15cd9a487bccf79b5adaeb.

Formula blob: 6f6b21bb5a47f479a0c3d2f584ea62e28e24e1d5.

Formula SHA-256: 2ae6f213c52e14623229f2ae6c93f89bc06797f5db6bb42911cd59718d1536e9.

All five commits range-diff identically from the previously accepted series. The diff is source-only: Formula/bc.rb and its README catalog row. It contains no bottle block, sidecar, archive, receipt, provenance metadata, or Wasm artifact.

Validation

Through Kandelo's scripts/dev-shell.sh on the exact restacked head:

  • Ruby syntax: passed.
  • brew style: one file inspected, no offenses.
  • Current merged formula-support suite: 37 runs, 279 assertions.
  • git diff --check: passed.
  • clean-worktree and cumulative range-diff checks: passed.

Earlier ABI 18 source and runtime evidence covered the complete 14-file keg, exact bc/dc versions, 2^128, 30-digit division, and a real dc child command on Node and Chromium. Neither executable contained legacy Asyncify or a fork-continuation surface.

That runtime evidence remains historical rather than an exact-head bottle or publication claim. The Formula is byte-identical at the blob above, so its source/test/artifact contract is unchanged; only branch history and README context changed.

Gates

Source merge is blocked until Automattic/kandelo#882 lands so the merged tap validator can identify aliased/stripped ABI exports without false rejection.

Trusted bottle publication additionally waits on the applicable platform/publisher work in Automattic/kandelo#842, #874, #881, #885, and #887; tap #22 if a branch dry run is needed; a fresh exact merged-head rebuild for the ABI selected by the external batching work; reviewed sidecars; and stock-guest Node/Chromium pours against published bytes.

Automattic/kandelo#873 and #888 do not apply because these outputs are not fork-instrumented. #890 does not apply because BC has no same-tap target dependency. #905 is not required for the current child-execution/output claim; it would become a gate for a parent-PID observability assertion. No platform or ABI change is included here.

@brandonpayton

Copy link
Copy Markdown
Member Author

Independent devil's-advocate review on 2c793e2 found no formula-code blocker.

Verified independently:

  • literal Node brew test passes;
  • exact installed bc/dc binaries pass Chromium file-input arithmetic and dc shell-child execution with guest PATH=/no-such-path;
  • dc uses posix_spawn, with no kernel_fork, fork instrumentation, Asyncify marker, wrapper, or embedded Cellar path;
  • the keg has no undeclared runtime package surface;
  • strict online audit, style, Ruby syntax, and diff checks pass.

The review did identify one additional release gate, not a formula workaround: both binaries export __abi_version from the internally named __wasm_posix_user_abi_version, and current main's shell guard extracts no version from that shape. Automattic/kandelo#882 is the existing root-cause fix, so it is now an explicit bottle gate alongside #842, #867, and #874. Trusted bottles from 2c793e2 still need stock guest pour and literal tests before merge.

@brandonpayton
brandonpayton force-pushed the migrate/bc-cli branch 4 times, most recently from c85147d to e674f8d Compare July 12, 2026 03:38
@brandonpayton

Copy link
Copy Markdown
Member Author

Exact-head update after tap #70

This branch is now based directly on tap main 36df17ec5395fb4531fddc2d9ab769eb1e6c19ca and uses the merged fail-closed Wasm artifact validator. Current head: e674f8dbccedcda7b17d0dbdc56f30ac9e8fb8f9.

Formula/bc.rb blob 6f6b21bb, SHA-256 2ae6f213...8d1536e9.

Through Kandelo's dev shell, the combined eight-formula syntax/style pass is clean, the merged support suite passes 29/216, and branch diff checks pass. A fresh exact-head devil review is still required.

This supersedes the older restack head/base/hash paragraph in the PR body. Source materialization remains gated on Automattic/kandelo#882; no bottle, sidecar, receipt, provenance, or poured-install claim is made by this update.

@brandonpayton

Copy link
Copy Markdown
Member Author

Independent devil review: ACCEPT at exact head e674f8dbccedcda7b17d0dbdc56f30ac9e8fb8f9 on base 36df17ec5395fb4531fddc2d9ab769eb1e6c19ca.

The review independently verified the official source checksum and GPL-3.0-or-later headers; confirmed generated parser/lexer inputs make Flex/Bison unnecessary; verified host-only Texinfo and complete upstream installation of both programs, manpages, and Info manuals; and checked both final ABI 18 artifacts through the merged fail-closed validator. The explicit fork-free policy is correct for bc and dc: dc's child command lowers through musl system() to Kandelo's non-forking posix_spawn syscall path, which the formula test exercises.

Focused validation through scripts/dev-shell.sh: Ruby syntax, Homebrew style, 29 support tests / 216 assertions, and git diff --check all pass. The source-only diff and exact merge tree are clean.

Do not merge yet: Automattic/kandelo#882 remains the declared hard source gate for authoritative ABI extraction. No bottle or publication claim is made.

@brandonpayton

Copy link
Copy Markdown
Member Author

Exact-head devil review after the history-only restack: APPROVE for source merge after Automattic/kandelo#882 at 6b6b8623b1a2ec9ccbcd575a0c408706aa3a3db7.

The Formula blob is exactly 6f6b21bb5a47f479a0c3d2f584ea62e28e24e1d5, byte-identical to accepted head e674f8dbccedcda7b17d0dbdc56f30ac9e8fb8f9; Formula SHA-256 is 2ae6f213c52e14623229f2ae6c93f89bc06797f5db6bb42911cd59718d1536e9. Fresh exact-head checks: Homebrew style inspected 1 file with no offenses, Ruby syntax and git diff --check pass, and the worktree is clean. The shared validator/support blobs match the just-executed 30-run / 221-assertion suite.

The explicit fork-forbidden policy remains correct: both real GNU outputs use the ABI 18 SDK and dc child commands exercise posix_spawn, not fork continuation. Texinfo is host-only and upstream install owns both programs and manuals. This is source approval only; bottle publication still requires exact merged-head builds and stock Node/Chromium pours.

@brandonpayton

Copy link
Copy Markdown
Member Author

Independent history-only restack review: APPROVE exact head c3b9ad3. Formula blob and SHA-256 remain byte-identical to the previously accepted source/runtime candidate; the README delta is only the BC catalog row; exact syntax, diff, and Homebrew style checks pass. Source merge remains gated on Automattic/kandelo#882, and bottle publication still requires the stated final rebuild and guest proofs.

@brandonpayton

Copy link
Copy Markdown
Member Author

Independent exact-head review completed for 7d2091c23fb628c3de15cd9a487bccf79b5adaeb: ACCEPT.

  • The worktree is clean, tap main c5705667a90b05754d2244a362f3f7fc95d2f9c3 is its base, and all five commits range-diff identically from the previously accepted series.
  • Formula blob 6f6b21bb5a47f479a0c3d2f584ea62e28e24e1d5 and SHA-256 2ae6f213c52e14623229f2ae6c93f89bc06797f5db6bb42911cd59718d1536e9 are unchanged.
  • Binaryen/WABT provide the fail-closed inspection closure; Texinfo owns the manuals; there is no same-tap target/runtime dependency.
  • Both linked outputs correctly require fork: :forbidden; dc shell escapes use native posix_spawn and the behavior tests are substantive.
  • Exact-head syntax, style, support 37/279, diff, and range checks passed.
  • #882 is the source gate. #873/#888 do not apply, and #905 is not required for the current child-output claim.

No code blocker was found. Publication remains gated on a fresh exact-merged-head rebuild and Node/Chromium pours for the final consolidated ABI.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant