ghostty-org/ghostty at 46edeee · static read-only analysis · why-not-rust method 2.0ghostty-org/ghostty @ 46edeee · 静态只读分析 · why-not-rust 方法 2.0
Repository: github.com/ghostty-org/ghostty at commit 46edeee407ff1cd15fb7db3837025386b2f3a327, shallow clone, 5,815 tracked files. Scope: the whole repository, with src/terminal behind the libghostty C ABI as the candidate seam. Sampling: 755 tracked .zig files hold 311,038 lines, of which 97,412 sit inside test blocks, leaving 213,626. src/terminal is 140,441 lines across 141 files, 74,160 of them inside test blocks. macos/Sources holds 160 .swift files and 32,377 lines; 67 import AppKit, 63 import SwiftUI, 36 import Cocoa. macos/Tests and macos/GhosttyUITests add 2,201 lines. src/apprt is 28,408 lines, 79 of its files under gtk/. Ten C++ translation units are tracked: four are Ghostty's own in src/simd at 995 lines, one is simdutf's vendored amalgamation at 42,510 lines (52,566 with its header), three are Highway shims totalling 240 lines, and the remaining two are an imgui binding and an example. Google Highway's own source is fetched at build time, not vendored, so it is named and not counted. The include/ tree is 11,353 lines across 34 files. Exported C symbols: 90 unique 'export fn ghostty_*' names in src/ (71 in src/apprt/embedded.zig, 13 in src/config/CApi.zig, 5 in src/main_c.zig, 1 in src/benchmark/CApi.zig) plus 185 unique '@export' names in src/lib_vt.zig, with zero overlap between the two sets, for 275 total. Zig source carries 3,524 inline test blocks, 2,579 of them in src/terminal. test/fuzz-libghostty ships three AFL++ harnesses and 4,001 committed corpus files. Build flags were read from the workflows: .github/workflows/release-tag.yml:177 builds the tagged macOS release ReleaseFast, while .github/workflows/release-tip.yml:929 builds a ReleaseSafe macOS app that is then codesigned, notarized and published as ghostty-macos-universal-debug-fast.zip. PACKAGING.md:111 states the reason. build.zig.zon:6 pins minimum_zig_version 0.16.0. GitHub API: 5 published security advisories (CWE-78, CWE-94, CWE-284, plus two without a CWE), none memory-safety; 12 version tags from v1.0.0 on 2024-12-26 to v1.3.1 on 2026-03-13; 425 contributors listed with 16,557 contributions, the top author holding 11,397. No build, test, benchmark or run was performed against the project. Objective: no specific RFC was supplied, so the assessment takes the commonly argued proposal that a terminal parsing untrusted input should be Rust rather than Zig. User-supplied facts: none. No Amdahl calculation appears: D2 is UNKNOWN because no published profile locates Ghostty's frame time, and a line share is not a time share. The decision turns on G3 and G4. G3 fails because the smaller option is a build flag whose cost has never been published, and G4 fails on 275 exported C symbols across two frontends written in other languages. This is a structured decision protocol, not a statistical predictor.仓库:github.com/ghostty-org/ghostty,commit 46edeee407ff1cd15fb7db3837025386b2f3a327,shallow clone,5,815 个纳管文件。范围:整个仓库,候选接缝是 libghostty C ABI 后面的 src/terminal。采样:755 个纳管 .zig 文件共 311,038 行,其中 97,412 行在 test 块内,余 213,626 行。src/terminal 是 141 个文件、140,441 行,其中 74,160 行在 test 块内。macos/Sources 有 160 个 .swift 文件、32,377 行;67 个 import AppKit,63 个 import SwiftUI,36 个 import Cocoa。macos/Tests 与 macos/GhosttyUITests 另有 2,201 行。src/apprt 是 28,408 行,其中 79 个文件在 gtk/ 下。纳管的 C++ 翻译单元共十个:四个是 Ghostty 自有的,在 src/simd,995 行;一个是 simdutf 入库的合并源码,42,510 行(含头文件 52,566 行);三个是 Highway 的胶水层,合计 240 行;剩下两个是 imgui 绑定和一个示例。Google Highway 自身的源码在构建时才拉,没有入库,所以只点名不计数。include/ 树是 34 个文件、11,353 行。导出 C 符号:src/ 里 90 个不重复的 'export fn ghostty_*'(src/apprt/embedded.zig 71 个,src/config/CApi.zig 13 个,src/main_c.zig 5 个,src/benchmark/CApi.zig 1 个),加 src/lib_vt.zig 里 185 个不重复的 '@export',两组之间零重叠,合计 275 个。Zig 源码里有 3,524 个内联 test 块,其中 2,579 个在 src/terminal。test/fuzz-libghostty 提供三个 AFL++ harness 和 4,001 个入库语料文件。构建开关取自 workflow:.github/workflows/release-tag.yml:177 用 ReleaseFast 构建正式的 macOS 发布版,而 .github/workflows/release-tip.yml:929 构建的是 ReleaseSafe 的 macOS 应用,随后签名、公证,并以 ghostty-macos-universal-debug-fast.zip 发布。PACKAGING.md:111 写了原因。build.zig.zon:6 把 minimum_zig_version 钉在 0.16.0。GitHub API:5 条公开安全公告(CWE-78、CWE-94、CWE-284,另两条没有 CWE),无一属于内存安全;12 个版本 tag,从 2024-12-26 的 v1.0.0 到 2026-03-13 的 v1.3.1;列出 425 位贡献者、16,557 次贡献,头号作者占 11,397 次。没有对项目做过任何构建、测试、基准或运行。目标:没有人给出具体 RFC,因此按常见的那个说法评估——解析不可信输入的终端应该用 Rust 而不是 Zig。用户提供的事实:无。本报告没有 Amdahl 计算:D2 是 UNKNOWN,因为没有公开 profile 定位 Ghostty 的帧时间,而代码行数占比不等于时间占比。决策落在 G3 和 G4。G3 失败,是因为更小的那个方案只是一个构建开关,而它的代价从来没被公布过;G4 失败,是因为 275 个导出 C 符号背后是两套用别的语言写的前端。这是一套结构化决策流程,不是统计预测器。
| What we don't know证据缺口 | What it would change会改变什么 |
| A published ReleaseFast-versus-ReleaseSafe measurement on src/benchmark's VT harnesses在 src/benchmark 的 VT harness 上公布 ReleaseFast 与 ReleaseSafe 的对比 | This is the number the whole decision turns on. PACKAGING.md calls the safe build too slow; nothing published supports or refutes that. The harnesses are already in the tree.整个决策就压在这个数字上。PACKAGING.md 说安全构建太慢,但没有任何公开材料支持或否证它。harness 本来就在仓库里。 |
| A classification of AFL++ findings in src/terminal into spatial, temporal and logic把 src/terminal 里 AFL++ 的发现分成空间类、时间类、逻辑类 | Without it the Rust extraction rests on a mechanism rather than a realized defect. It would also tell the safe build how much of the class it actually covers.没有它,Rust 抽取方案只站在机制上,站不到已发生的缺陷上。它同时也能告诉安全构建:这个缺陷类里它真正覆盖了多少。 |
| Any published profile of where Ghostty's frame time goes任何一份关于 Ghostty 帧时间去向的公开 profile | D2 stays UNKNOWN while it is missing, so no performance claim about any option here can be authorized in either direction.它缺着的时候 D2 就停在 UNKNOWN,因此这里任何方案的性能主张,往哪个方向都授权不了。 |