Repository navigation
Conversation
Japabu
force-pushed
the
wt/toyos-pkg
branch
2 times, most recently
from
October 21, 2026 06:03
2fd0798 to
13fef0e
Compare
This was referenced Oct 21, 2026
Japabu
added a commit
that referenced
this pull request
Oct 21, 2026
The owner asked whether everything self-hosting needs is written down. toyos-builds-itself.md held it in five lists in an order it called open: what to build, what other tracks block, what stops M2, what M3 adds and what else is owed. It is now one list in dependency order: each item has its status, the issue that owns it and what blocks it, and the evidence it rests on is below it, with libc's revision for the compiles. The status words say only what is true: "direction set" is the owner's ruling of what an item must do, with its design still engineering's. The memory and socket designs, which are outside the tree and under review, are named as such, and so is the sequencing the socket design proposes for the descriptor work's spawn. Folded in: - C reaches served files (#975, #978, #988); - #970's toolchain package; - the memory direction; - the process track's stages 4 to 7; - socket sharing; - the boot handoff, beside the path; - the database feasibility study's libc findings; - the issues that name this track as their owner, among them pread, libc++'s std::filesystem, and the two that keep a build from reproducing. Each owner ruling of 2026-10-21 is recorded once, in its owning issue: - the signal scope in the process track; - sharing rather than moving, in the socket issue, whose exit described a move; - the database rulings in a new track, split from the planning dispositions made under delegation. Four findings get a home: - unlink-while-open; - libc's uid and gid; - sigaction's false success; - st_nlink 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Japabu
added a commit
that referenced
this pull request
Oct 21, 2026
The owner asked whether everything self-hosting needs is written down. toyos-builds-itself.md held it in five lists in an order it called open: what to build, what other tracks block, what stops M2, what M3 adds and what else is owed. It is now one list in dependency order: each item has its status, the issue that owns it and what blocks it, and the evidence it rests on is below it, with libc's revision for the compiles. The status words say only what is true: "direction set" is the owner's ruling of what an item must do, with its design still engineering's. The memory and socket designs, which are outside the tree and under review, are named as such, and so is the sequencing the socket design proposes for the descriptor work's spawn. Folded in: - C reaches served files (#975, #978, #988); - #970's toolchain package; - the memory direction; - the process track's stages 4 to 7; - socket sharing; - the boot handoff, beside the path; - the database feasibility study's libc findings; - the issues that name this track as their owner, among them pread, libc++'s std::filesystem, and the two that keep a build from reproducing. Each owner ruling of 2026-10-21 is recorded once, in its owning issue: - the signal scope in the process track; - sharing rather than moving, in the socket issue, whose exit described a move; - the database rulings in a new track, split from the planning dispositions made under delegation. Four findings get a home: - unlink-while-open; - libc's uid and gid; - sigaction's false success; - st_nlink 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Japabu
added a commit
that referenced
this pull request
Oct 21, 2026
The owner asked whether everything self-hosting needs is written down. toyos-builds-itself.md held it in five lists in an order it called open: what to build, what other tracks block, what stops M2, what M3 adds and what else is owed. It is now one list in dependency order: each item has its status, the issue that owns it and what blocks it, and the evidence it rests on is below it, with libc's revision for the compiles. The status words say only what is true: "direction set" is the owner's ruling of what an item must do, with its design still engineering's. The memory and socket designs, which are outside the tree and under review, are named as such, and so is the sequencing the socket design proposes for the descriptor work's spawn. Folded in: - C reaches served files (#975, #978, #988); - #970's toolchain package; - the memory direction; - the process track's stages 4 to 7; - socket sharing; - the boot handoff, beside the path; - the database feasibility study's libc findings; - the issues that name this track as their owner, among them pread, libc++'s std::filesystem, and the two that keep a build from reproducing. Each owner ruling of 2026-10-21 is recorded once, in its owning issue: - the signal scope in the process track; - sharing rather than moving, in the socket issue, whose exit described a move; - the database rulings in a new track, split from the planning dispositions made under delegation. Four findings get a home: - unlink-while-open; - libc's uid and gid; - sigaction's false success; - st_nlink 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es the toolchain pkg read a whole archive into memory under a 256 MiB ceiling and refused every link, so the toolchain M2 needs (clang, LLD and the C sysroot, 279 MB installed) could not be installed. pkg now reads an archive twice and never holds it: a survey hashes the whole file and plans it header by header within the room the volume under /apps has, and the unpack meets that plan header for header and the digest again at the end, so an archive changed between the reads installs nothing and writes nothing the plan did not check. The room replaces MAX_INFLATED as the bound on what a survey inflates. Before the manifest is written the volume is synced through /apps's capability, which refuses if any file was left unwritten: a file's last close can be refused, and std's File drops that answer. The room is a new file-server request, ROOM: the free bytes of the volume behind a capability and its allocation unit, answered by bcachefs's spare blocks, FAT32's free clusters, and none for an absent or read-only volume. A package may carry symlinks that resolve inside it: relative, `..` only first and never past the package's own directory, and nothing is written beneath a link or a file. The package's directory is no link, and the manifest is the installer's alone. Hard links, pax and GNU long names stay refused. A package's program is `<name>/<name>` or `<name>/bin/<name>`, so a manifest's program may be nested inside its directory. pkg asks ToyOS's file server for room, so it is declared exempt as ToyOS-only. `--hosted-clang` packages its clang and LLD with clang's resource headers, the C sysroot and LLVM's licence as clang-v<version>-toyos-x86_64.tar.gz, deterministic, with `cc` and `clang++` linked to clang and a `<triple>.cfg` naming the sysroot beside the binaries. hosted_clang_hello installs that package with pkg on a 1 GiB DATA and compiles and links hello.c with /apps/clang/bin. Its image starts the block service and the NVMe driver as the split of #971 has them. libc's posix_spawn reads a program a file server holds into a memory object the kernel pages the child from, as std's Command does, since the kernel opens only what it serves; clang's driver starts cc1 and ld.lld that way. The guest row installs and compiles, and stops at the link: clang's driver starting cc1 from /apps is refused ENOMEM, the kernel's ResourceExhausted, while a small std parent starts ld.lld from there. The image object is allocated physically contiguous, about 148 MB for clang, and the memory track's stages 1 to 3 remove that; the track and the memory issue record it as the row's blocker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Japabu
added a commit
to ToyOSOrg/evidence
that referenced
this pull request
Oct 22, 2026
…9c584380bd62: --ci host, both builds, guest rows, the ENOMEM diagnosis; masked
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Earlier status (before the rebase):
cargo run -- --ci hostexit 0 at13fef0ed0; the other checks below were run atb77180845.Status: draft. Clang installs and compiles in the guest. The link is blocked on the memory track (item 5 of
issues/toyos-builds-itself.md), and this PR does not work around it. Rebased onto main after #988 and #991; head6f398f518.What the guest row shows (
hosted_clang_hello, QEMU x86_64):pkg installexits 0 and installs 279 MB at/apps/clang.clang -c hello.cexits 0.cc hello.cfails: the driver'sposix_spawnof/apps/clang/bin/clang -cc1is refusedENOMEM. That was read with libc's realstrerrorapplied temporarily; today'sstrerrorsays "unknown error" for every code, and the libc follow-up fixes that./apps/clang/bin/ld.lld --versionfine.Cause. A program on a file server is spawned from a copy in one memory object.
SYS_SHM_CREATEallocates that object physically contiguous (kernel/src/object/shm.rs,alloc_contiguous), about 148 MB for clang. The errno is measured; that this allocation is the one refused is inferred, since the kernel logs nothing for it. The memory track's stages 1 to 3 remove contiguous user memory, andprocess-memory-is-2-mib-pages…records this row as its check. The row stays as written: it asserts the M2 exit, and is red until those stages land. It runs on demand only.This round:
ROOMis renumbered 23, after main's DUP, SEEK and EXPORT.pkgsaw no room.posix_spawnreads a served program into an image object, as std'sCommanddoes.Checks at the head:
--ci host0 (87 steps), both builds 0,libc_childrenpasses,hosted_clang_hello1 as above. Evidence: https://github.com/ToyOSOrg/evidence/tree/bc6bfb7a24cc74dfc9f6759fa454ba3dc3f3dd10/r2Problem
M2 of
issues/toyos-builds-itself.mdis clang, LLD and their runtime installed by/system/bin/pkg, andclang hello.c && ./a.outworking in the guest.hosted_clang_hellostaged the binaries on ROOT becausepkgcould not install a toolchain: it read the whole archive into memory, inflated it under a 256 MiB ceiling (MAX_INFLATED) and refused every link. The toolchain installs 279 MB.Resulting behaviour
pkgstreams. An archive is read twice and never held: a survey hashes the whole file and plans it header by header; the unpack meets that plan header for header and the digest again at the end. An archive changed between the reads installs nothing, and the second read writes only paths the first checked. Memory is a 1 MiB buffer and the plan's headers (at most 65536 entries).ROOM, answers the free bytes of the volume behind a capability and its allocation unit (bcachefs: spare blocks less the delete reserve; FAT32: free clusters; none for an absent or read-only volume). The survey refuses an entry when the plan passes the room, at its header and before its data, so the room replacesMAX_INFLATEDas the bound on what a survey inflates. Metadata that still fills a volume part way meets the existing unwind.pkgsyncs the volume through/apps's capability, which refuses if any file was left unwritten: a file's last close can be refused, and std'sFiledrop discards that answer. (The guest showed exactly this before bcachefs: a split of a tree's first child keeps its siblings after it #969:pkgreported success over an entry the server failed to write.)..only first and never past the package's own directory, and nothing is written beneath a link or a file, so no chain of links reaches outside. The package's directory is no link andmanifest.tomlis the installer's alone. Hard links (the filesystem has none), pax and GNU long names stay refused; GNU tar's header is read without its non-prefix field as a prefix.<name>/<name>(gbae's shape) or<name>/bin/<name>(a toolchain's); both is refused as unsaid.toyos_manifest::package::program_is_insideaccepts a nested file of the package's own directory.SHA256SUMSbeside the file, now over the streamed bytes, every byte of the file included.cargo run -- --hosted-clangalso writestarget/hosted-clang/clang-v22.1.8-toyos-x86_64.tar.gz(83.8 MB) and itsSHA256SUMS:clang/bin/{clang,ld.lld}, linksccandclang++toclang,bin/x86_64-unknown-toyos.cfgnaming--sysroot=<CFGDIR>/../sysroot(clang's documented configuration-file lookup beside its executable, so a compile needs no--sysrootand the hosted clang's key does not move), clang's resource headers atlib/clang, the C sysroot'sincludeandlibatsysroot, and LLVM'sLICENSE.TXT. Deterministic: fixed order, no owner, no time.hosted_clang_hellostages only the package and its sums, bootstests/images/hostedclangcase.toml(now with diskserver, fileserver andpkg) on a 1 GiB DATA (BootOptions::data_bytes), runspkg install … --yes, then compiles with/apps/clang/bin/clang -c, links with/apps/clang/bin/cc hello.c, runs it and compares both products with the host's bytes.pkgis declaredexempt.manages: asking ToyOS's file server for room is a ToyOS-only job.What stopped the compile before #988 (measured, historical)
-v:InstalledDir:is empty, so the configuration file beside it is never looked for. LLVM'sgetMainExecutabletakes thedladdrroute on ToyOS andrealpaths the name; libc'srealpathresolves by the kernel's mounts (ROOT and/tmp), which hold no/apps. The staged run of libc starts and waits for children, and clang's driver links inside ToyOS #961 passed because ROOT is the kernel's.--sysroot=/apps/clang/sysroot -resource-dir /apps/clang/lib/clang/22given explicitly, clang reportsignoring nonexistent directory "/apps/clang/sysroot/include"while std, in the same job, sees it andstdio.h(2073 bytes) in it. libc'sopen/statgo to the kernel only.Both are
issues/c-programs-name-no-file-a-file-server-holds.md, whose exit is libc on one SDK file-server client that std uses too. The track now says so.Decisions
issues/a-package-cannot-ship-its-own-libraries.mdmoot for M2: neither binary has aPT_INTERPor aDT_NEEDED. It stays open for M3's rustc launcher.DEFAULT_SYSROOT: relocatable, upstream's mechanism, no LLVM rebuild.Checks and evidence
All at
b77180845unless said.cargo run -- --ci host: exit 0, 87 steps green (also green at the pre-bcachefs: a split of a tree's first child keeps its siblings after it #9693c0982343).cargo run -- --build-only: exit 0 for x86_64 and for--arch aarch64.ROOM; the package's layout and determinism (build/hostedclang.rs).cargo test --test toyos-build -- hosted_clang_hello(QEMU x86_64, Headless profile, local): exit 1.pkg installexits 0 (installed clang 22.1.8 at /apps/clang (279248896 bytes)), thenclang -cexits 1 onstdio.has above. Before bcachefs: a split of a tree's first child keeps its siblings after it #969 the same run logged the file server'sNotFoundentry failure; after it, none.1ed2a0875fe8cbf6, clang 147,727,208 bytes and ld.lld 85,761,568 bytes;readelf -l -dshows noINTERPand noNEEDED.Evidence, at
ToyOSOrg/evidence@371b2e4(index): ci-host2.log, ci-host.log (pre-#969), build-only-x86_64.log, build-only-aarch64.log, guest-final.log, guest1.log (the NotFound entry failure before #969), guest-diag1.log (InstalledDir:empty), guest-diag2.log (libc vs std on/apps), static-pie.log, mutations/run-final.log with run.sh and the patches beside it, hostedclang2.log.Risks and gaps
PATHis/system/bin); recorded in the track.libtoyos_c.alinks; owed before a package is published beyond a test's ROOT; recorded in the track.clang++is shipped as a link and not exercised in the guest.🤖 Generated with Claude Code