Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(init): task_for_pid 失败时按 root 状态分流提示#109

Open
jackwener wants to merge 1 commit into
main from
fix/init-sudo-hint
Open

fix(init): task_for_pid 失败时按 root 状态分流提示 #109
jackwener wants to merge 1 commit into
main from
fix/init-sudo-hint

Conversation

@jackwener

@jackwener jackwener commented Jun 11, 2026

Copy link
Copy Markdown
Owner

问题

wx init 抓密钥时若 task_for_pid 失败(kr=5),无论什么原因都提示用户去 codesign 重签微信。

但 kr=5 (KERN_FAILURE) 最常见的原因是没加 sudo —— task_for_pid 读取其他进程内存始终需要 root,这跟签名/SIP 无关。对于已关闭 SIP 的用户,重签完全没必要,他们只是缺一个 sudo,旧提示是误导。

改动

src/scanner/macos.rs 里按 geteuid() 分流:

  • 非 root:提示 sudo wx init(最常见情形),并附注「若已 sudo 仍失败才是 SIP+签名问题」。
  • 已是 root 仍失败:才显示原来的 codesign 重签步骤,并补一句「已关闭 SIP 则无需重签」。

验证

  • cargo build 通过。
  • 非 root 运行 wx init --force 现在正确显示「请改用 sudo 重新运行」。

非 root 运行是 kr=5 最常见原因,先提示加 sudo;
仅当已是 root 仍失败(SIP 开启 + 官方签名)才提示 codesign 重签。
原提示无脑让用户重签,对关闭 SIP 的用户是误导。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /