fix(examples): make_code.py contradicts the documented UI import order

未关闭 适合新手
#8,713 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

结合 python/examples/README.md 阅读 “UI Plugins” 下的 docs/dev/plugins.md,然后检查 python/examples/make_code.py:10–11 中的导入。更新示例,使其遵循文档规定的导入顺序,同时保留 “Make Code” 操作和 renderer 的行为。示例展示了文档规定的顺序即为完成;此 issue 并未认定存在运行时故障或需要修复的问题。

由索引模型根据 Issue 内容生成。

描述

Summary

The make_code.py GUI plugin example imports PySide6.QtGui before binaryninjaui, reversing the order that the UI plugin guide tells Python UI plugins to always use. This report concerns the example's inconsistency with that guidance. It does not claim that this example crashes or that it loads an incorrect Qt library in a current installation.

Runtime or environment

  • Binary Ninja source: latest published release stable/6.0.10905, commit 775c3b5eed8598217b20e1087afe7aa092a9b4b1; current default branch dev, commit 74749a72a606532e3984b605518bd49094020699.
  • Edition, OS, OS version, CPU architecture: not applicable to this source/documentation comparison. No Binary Ninja runtime was executed for this report.

Steps to reproduce

  1. At either source baseline, read the Python UI plugin import-order rule in docs/dev/plugins.md, under “UI Plugins.”
  2. Read python/examples/README.md, which lists make_code.py under “GUI Plugins” and says these plugins require the UI to be running.
  3. Compare the rule with the consecutive imports at python/examples/make_code.py:10–11.

These source-inspection steps were performed on both baselines. No GUI or headless execution steps are asserted as reproduced.

Expected behavior

An official example identified as a Python GUI plugin demonstrates the import order documented for Python UI plugins: binaryninjaui before PySide6. The guide states this rule for UI plugins themselves; it does not document a GUI-context exemption.

Actual behavior

Both source baselines contain the same example bytes, including:

import sys
from PySide6.QtGui import QKeySequence
from binaryninjaui import UIActionHandler, UIAction, UIActionContext

The example is intended to run in the GUI. Whether binaryninjaui or the appropriate PySide bindings have already been imported in any particular GUI session was not measured. No resulting runtime failure, incorrect library selection, or crash is established here.

Evidence

  • Expected source: UI Plugins guidance, which requires the opposite order for Python UI plugins.
  • Failure source: make_code.py imports.
  • Evidence provenance: static
  • Local verification: static-proof
  • Reproduction completeness: complete

Runtime reproduction was not run. This is a direct comparison of the release and default-branch source artifacts. The examples README identifies this file as a GUI plugin, establishing the scope of the documented convention. An AST inspection confirmed the consecutive import order in both source baselines. The proof establishes the example/guidance discrepancy only.

Restoration check

Compare this example with the UI plugin guide again: the example should demonstrate the documented import order, or the guidance should state an applicable supported exception. Preserve the example's “Make Code” action and renderer behavior. A successful comparison should not be presented as proof that a runtime crash has been fixed.

References

Issue #3196 introduced the UI plugin best-practice documentation and is closed as completed. This report concerns the example that still uses the contrary order, not missing best-practice documentation or a reproduced recurrence of an old crash.

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: The official GUI plugin example contradicts an explicit documentation convention. This is an example consistency/cleanup defect; consequential runtime impact has not been demonstrated.
  • Workaround status: available
  • Workaround basis: Readers can follow the documented import order when adapting the example. The documented order is directly available in the same repository; no runtime fix or crash workaround is claimed.
主要语言
C++
星标
1.3k
派生
304
平均合并
2 天 20 小时
30 天内合并 PR
10

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Vector35/binaryninja-api 的其他 Issue

查看 Vector35/binaryninja-api 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。