Skip to content

2026.12.6.2: a closed reader ends mcpp by SIGPIPE on musl; a tip stands apart from a block of results; a root's override holds against the platform's version group - #1046

Merged
Sunrisepeak merged 8 commits into
mainfrom
fix/one-write-of-a-document
Dec 6, 2026

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Dec 6, 2026 •

Copy link
Copy Markdown
Member

2026.12.6.2 is the fix of a defect the real verification of 2026.12.6.1 found: on Linux, a text over 256 bytes whose reader is gone ends mcpp in std::terminate instead of by SIGPIPE.

Measured. The released mcpp-2026.12.6.1-linux-x86_64 (musl, static) with a standard output whose reader has closed: mcpp --help, mcpp --agent-skill-doc, mcpp build --agent-skill-doc, mcpp self env --format json and mcpp --protocol-version each end by SIGABRT with terminate called after throwing an instance of 'std::system_error' (30 of 30 runs for --help). 2026.12.4.1 does the same for the last four; --help reached it in 2026.12.6.1, where mcpplibs.cmdline 0.4.0 prints the help as one text. main's CI found it (e2e 941) after the merge of #1044.

Cause. libstdc++ 16's std::print on musl formats into a 256-byte buffer and writes it when it fills; when that write is refused it throws without resetting the buffer, and ~_File_sink() noexcept(false) writes the buffer again while the exception unwinds. The second exception during unwinding is std::terminate; mcpp's handler for std::system_error (end_for_closed_output, SIGPIPE after the ordered finish) is never reached. A glibc build takes the other sink and does not show it. A 15-line program reproduces it (musl: SIGABRT; glibc: the handler runs).

Fix.

  • mcpp::ui::document(text) writes a whole result through the ui's one writer (one fwrite; a closed reader ends mcpp by SIGPIPE in order): the JSON envelopes (wire::emit), the protocol document, the package sheet, self explain, the completion script, emit surface, emit sbom, emit xpkg, the build database's text, the xpkg Lua of publish, the cache's JSON, and the test records.
  • mcpplibs.cmdline 0.4.1 (0.4.1: the program's text leaves in one write; a refused write throws once mcpplibs/cmdline#20, mcpp-index#993) writes its help, version, completions and sheets with write_out: one fwrite, one exception.

Tests. e2e 941 B: --help, two sheets, a JSON envelope and --protocol-version, each with a closed reader, end by SIGPIPE and print no terminate. A locally built x86_64-linux-musl static mcpp passes all five; its --help is byte-identical to the glibc build's. GCC and LLVM 23.1.3 builds pass.

e2e 1066. The index now holds mcpplibs.os 0.4.10, which the case's pattern 0\.4\.[2-9] did not match (macOS LLVM job: Merged mcpplibs.os 0.4.10 ⨯ 0.4.1 → v0.4.1, the merge itself right); the pattern takes any 0.4.x above 0.4.1.

Output layout (the report and tip rules of SPEC-012 §3.1).

  • On a terminal, a closing tip: stands one blank line below a block of results (a report, a list, a card); after a one-line result it follows the line; in a pipe the text is unchanged. tip: stays lower-case, a label of the family of error:, warning:, note:, help:; a capitalised Name: is a report's section.
  • A tip is one short sentence: mcpp info <name> shows a package; mcpp add <name> adds it after search (the table a package goes to is the line add prints), mcpp info <id> --fetch adds <rows> after info, mcpp build installs it for the build programs, the tests and mcpp run after adding a tool.
  • mcpp remove names the full identity, as add does. toolchain list sizes its columns by their widest cell (a long target or toolchain ran into the next column) and writes - for a row with no toolchain (the envelope keeps its value); its Toolchains rows carry no trailing spaces. The info card cuts a row at the terminal's edge with ..., as search does.
  • SPEC-012 v1.3, docs/09 (en, zh), the design record; e2e 1182 and path/23 follow the texts.

A root's override of a member of the platform's version group (mcpp#1045). docs/05 states that an override of a package the group lists is taken, with a warning naming the group's version. The root's own request was taken so, but a dependency's request for the package was still pinned to the group and refused, and the check after the walk refused the version the override had chosen: the warning announced a choice the build then rejected.

  • A root's override = true is the project's choice against the group's default (SPEC-013 §7.5 v1.18): every request of the package, a dependency's too, takes it; the check after the walk accepts the chosen version; the warning dependency/override-group is said once, and not at all when the override chooses the group's version.
  • The overriding declarations are the build's roots' (SPEC-004 §12 item 3, v1.33): the root's tables, [workspace.dependencies], and the tables of each member the build selects, a member being the root of its build, as [workspace.xlings.overrides] already reads it. Before, a member's override answered its own request only.
  • Two declarations that override one package with different versions or sources are refused naming both; before, the first one read decided by the order of the walk.
  • e2e 1188 builds the group from a path platform and a local index: the root's override with a dependency that asks ^1.0.0 builds and runs with one warning; a selected member's override under -p builds; two members with differing overrides under --workspace are refused naming both. docs/05 (en, zh) and the CHANGELOG follow.

Fresh install. The run for 2026.12.6.1 failed on four jobs at one assertion: the template's provenance line (namespace=mcpplibs name=imgui), which 2026.12.6.1 prints with --verbose only; the steps now pass --verbose, as e2e cli/templates does. The Termux app sandbox failed with no userland 300 s after the app's start (run-as: exec failed for …/usr/bin/env), reported as if mcpp had printed nothing; the start is repeated each minute for up to 600 s, and a userland that never appears is named.

The default platform: openkal-platform 0.32.3. mcpplibs.os 0.4.10 (mcpp-index#995, published during this PR's CI) asks for the openkal 0.26.2 family (openkal-linux >=0.27.4, openkal-macos >=0.24.3, openkal-windows >=0.23.3); 0.32.1's version group names 0.27.2, 0.24.1 and 0.23.1, so the canary's cxx x86_64-windows-musl test cell, whose test graph takes mcpplibs.os ^0.4.7, was refused (openkal-windows is requested as '>=0.23.3, <0.24.0' by mcpplibs.os@0.4.10, and the platform openkal-platform 0.32.1 is a version group). openkal-platform 0.32.3 differs from 0.32.1 by that family, openkal-image 0.7.4 and openkal-musl 0.30.6 only, and requires mcpp >=2026.11.17.1. Measured locally: a project with mcpplibs.os built --target x86_64-windows-musl is refused by 2026.12.6.1 with that message and builds with this tree (Platform openkal-platform 0.32.3 (built-in, hosted)). The released 2026.12.6.1 keeps the refusal on those rows; its tip names the platform release that admits the request. The target rows' snapshot (tests/fixtures/target-rows.snapshot) records the new platform; the three canaries pass with it.

@Sunrisepeak Sunrisepeak added the ci:canaries Run the canary matrix (canaries.yml) on this pull request label Dec 6, 2026
… sentence; remove names the full identity; toolchain list sizes its columns by their cells; the info card cuts a row at the terminal's edge
@Sunrisepeak Sunrisepeak changed the title 2026.12.6.2: a closed reader ends mcpp by SIGPIPE on musl, not in std::terminate 2026.12.6.2: a closed reader ends mcpp by SIGPIPE on musl; a tip stands apart from a block of results Dec 6, 2026
…project's choice in every request and in the check after the walk; a selected member's overrides answer its build; two differing overrides are refused (mcpp#1045)
@Sunrisepeak Sunrisepeak changed the title 2026.12.6.2: a closed reader ends mcpp by SIGPIPE on musl; a tip stands apart from a block of results 2026.12.6.2: a closed reader ends mcpp by SIGPIPE on musl; a tip stands apart from a block of results; a root's override holds against the platform's version group Dec 6, 2026
…e 2026.12.6.1 prints it; a Termux userland that never unpacks is named, and the app's start is repeated
…mcpplibs.os 0.4.10 asks for the openkal 0.26.2 family, which 0.32.1's version group refused
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:canaries Run the canary matrix (canaries.yml) on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant