fix(install): bail on missing binary when writing macOS app bundle - #1872
Open
wignerStan wants to merge 1 commit into
Open
fix(install): bail on missing binary when writing macOS app bundle#1872wignerStan wants to merge 1 commit into
wignerStan wants to merge 1 commit into
Conversation
write_bundle silently skipped copying the real binary when: - binary_source did not exist, or - binary_source == target (self-repair from inside the bundle) Both cases produced a bundle containing only the ~100-byte sh wrapper, so clicking the app icon exec'd a missing binary and failed silently with no window, no log, no error. install_entrypoints/repair_entrypoints still reported success. Now write_bundle errors out when the source is missing, when the source is a shell script rather than a real binary, or when source == target but the target is not a real binary. install_binary_source also falls back to the current_exe companion binary when the target resolves to '.' or a shell script. Fixes: empty-shell macOS app bundles after install/repair
Owner
|
感谢排查。这个问题已经在最新 当前 PR 与最新 |
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.
概述 (Summary)
Fixes #1871: macOS 安装/修复流程可能生成"空壳"
.appbundle(只有 sh 包装脚本、没有真实二进制),导致管理工具点击无法启动且全程无声。根因 (Root cause)
crates/codex-plus-core/src/install/macos.rs的write_bundle静默跳过二进制拷贝:source.exists()为 false → 跳过拷贝,仍返回Ok(()),UI 报"已安装/已修复"source == &target(自修复场景)→ 跳过拷贝,且不校验目标生成空壳后,
exec "$DIR/codex-plus-plus-manager"找不到二进制,点击图标静默失败(无窗口、无日志)。改动 (Changes)
crates/codex-plus-core/src/install/macos.rswrite_bundle现在会明确报错(bail!):binary_source/binary_target_name信息#!开头)——识别"包装脚本当二进制源"场景source == target但目标缺失或非真实二进制(自修复 no-op 防护)新增辅助函数:
is_shell_script(path):读取文件头判断#!is_real_binary(path):判断 size > 1KB 且非目录install_binary_source增强:.、缺失或为 sh 脚本,回退到current_exe()同目录 companion 二进制(非脚本),降低把包装脚本当源的概率验证 (Verification)
注意:本环境无 Rust 工具链,代码未经编译/测试。 需在 CI 或有 cargo 的环境运行:
cargo fmt --all -- --check cargo test -p codex-plus-core cargo build --release现场验证(用户机器,未覆盖于本 PR)
从 DMG 恢复真实二进制到两个 bundle 后,强杀 → 再次点击启动 → 进程存活、守卫端口 57319 LISTEN、日志出现
manager.start,强杀→重启闭环通过。相关文档
报告:
docs/reports/2026-08-17-macos-bundle-empty-shell-修复报告.md