0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 .. include:: ../disclaimer-zh_TW.rst
0004
0005 :Original: :doc:`../../../admin-guide/bug-bisect`
0006
0007 :譯者:
0008
0009 吳想成 Wu XiangCheng <bobwxc@email.cn>
0010 胡皓文 Hu Haowen <src.res@email.cn>
0011
0012 二分(bisect)缺陷
0013 +++++++++++++++++++
0014
0015 (英文版)最後更新:2016年10月28日
0016
0017 引言
0018 =====
0019
0020 始終嘗試由來自kernel.org的原始碼構建的最新內核。如果您沒有信心這樣做,請將
0021 錯誤報告給您的發行版供應商,而不是內核開發人員。
0022
0023 找到缺陷(bug)並不總是那麼容易,不過仍然得去找。如果你找不到它,不要放棄。
0024 儘可能多的向相關維護人員報告您發現的信息。請參閱MAINTAINERS文件以了解您所
0025 關注的子系統的維護人員。
0026
0027 在提交錯誤報告之前,請閱讀「Documentation/admin-guide/reporting-issues.rst」。
0028
0029 設備未出現(Devices not appearing)
0030 ====================================
0031
0032 這通常是由udev/systemd引起的。在將其歸咎於內核之前先檢查一下。
0033
0034 查找導致缺陷的補丁
0035 ===================
0036
0037 使用 ``git`` 提供的工具可以很容易地找到缺陷,只要缺陷是可復現的。
0038
0039 操作步驟:
0040
0041 - 從git原始碼構建內核
0042 - 以此開始二分 [#f1]_::
0043
0044 $ git bisect start
0045
0046 - 標記損壞的變更集::
0047
0048 $ git bisect bad [commit]
0049
0050 - 標記正常工作的變更集::
0051
0052 $ git bisect good [commit]
0053
0054 - 重新構建內核並測試
0055 - 使用以下任一與git bisect進行交互::
0056
0057 $ git bisect good
0058
0059 或::
0060
0061 $ git bisect bad
0062
0063 這取決於您測試的變更集上是否有缺陷
0064 - 在一些交互之後,git bisect將給出可能導致缺陷的變更集。
0065
0066 - 例如,如果您知道當前版本有問題,而4.8版本是正常的,則可以執行以下操作::
0067
0068 $ git bisect start
0069 $ git bisect bad # Current version is bad
0070 $ git bisect good v4.8
0071
0072
0073 .. [#f1] 您可以(可選地)在開始git bisect的時候提供good或bad參數
0074 ``git bisect start [BAD] [GOOD]``
0075
0076 如需進一步參考,請閱讀:
0077
0078 - ``git-bisect`` 的手冊頁
0079 - `Fighting regressions with git bisect(用git bisect解決回歸)
0080 <https://www.kernel.org/pub/software/scm/git/docs/git-bisect-lk2009.html>`_
0081 - `Fully automated bisecting with "git bisect run"(使用git bisect run
0082 來全自動二分) <https://lwn.net/Articles/317154>`_
0083 - `Using Git bisect to figure out when brokenness was introduced
0084 (使用Git二分來找出何時引入了錯誤) <http://webchick.net/node/99>`_
0085