Back to home page

OSCL-LXR

 
 

    


0001 .. include:: ../disclaimer-zh_CN.rst
0002 
0003 :Original: :doc:`../../../admin-guide/bug-bisect`
0004 
0005 :译者:
0006 
0007  吴想成 Wu XiangCheng <bobwxc@email.cn>
0008 
0009 二分(bisect)缺陷
0010 +++++++++++++++++++
0011 
0012 (英文版)最后更新:2016年10月28日
0013 
0014 引言
0015 =====
0016 
0017 始终尝试由来自kernel.org的源代码构建的最新内核。如果您没有信心这样做,请将
0018 错误报告给您的发行版供应商,而不是内核开发人员。
0019 
0020 找到缺陷(bug)并不总是那么容易,不过仍然得去找。如果你找不到它,不要放弃。
0021 尽可能多的向相关维护人员报告您发现的信息。请参阅MAINTAINERS文件以了解您所
0022 关注的子系统的维护人员。
0023 
0024 在提交错误报告之前,请阅读“Documentation/admin-guide/reporting-issues.rst”。
0025 
0026 设备未出现(Devices not appearing)
0027 ====================================
0028 
0029 这通常是由udev/systemd引起的。在将其归咎于内核之前先检查一下。
0030 
0031 查找导致缺陷的补丁
0032 ===================
0033 
0034 使用 ``git`` 提供的工具可以很容易地找到缺陷,只要缺陷是可复现的。
0035 
0036 操作步骤:
0037 
0038 - 从git源代码构建内核
0039 - 以此开始二分 [#f1]_::
0040 
0041         $ git bisect start
0042 
0043 - 标记损坏的变更集::
0044 
0045         $ git bisect bad [commit]
0046 
0047 - 标记正常工作的变更集::
0048 
0049         $ git bisect good [commit]
0050 
0051 - 重新构建内核并测试
0052 - 使用以下任一与git bisect进行交互::
0053 
0054         $ git bisect good
0055 
0056   或::
0057 
0058         $ git bisect bad
0059 
0060   这取决于您测试的变更集上是否有缺陷
0061 - 在一些交互之后,git bisect将给出可能导致缺陷的变更集。
0062 
0063 - 例如,如果您知道当前版本有问题,而4.8版本是正常的,则可以执行以下操作::
0064 
0065         $ git bisect start
0066         $ git bisect bad                 # Current version is bad
0067         $ git bisect good v4.8
0068 
0069 
0070 .. [#f1] 您可以(可选地)在开始git bisect的时候提供good或bad参数
0071          ``git bisect start [BAD] [GOOD]``
0072 
0073 如需进一步参考,请阅读:
0074 
0075 - ``git-bisect`` 的手册页
0076 - `Fighting regressions with git bisect(用git bisect解决回归)
0077   <https://www.kernel.org/pub/software/scm/git/docs/git-bisect-lk2009.html>`_
0078 - `Fully automated bisecting with "git bisect run"(使用git bisect run
0079   来全自动二分) <https://lwn.net/Articles/317154>`_
0080 - `Using Git bisect to figure out when brokenness was introduced
0081   (使用Git二分来找出何时引入了错误) <http://webchick.net/node/99>`_