Bibisect 二进制二分查找

From The Document Foundation Wiki
< QA‎ | Bibisect
Jump to: navigation, search

简介

二进制二分查找(Bibisect,即 "binary bisect"),是一整套在软件中定位导致了某项功能“倒退(Regressions)”的源代码提交(commit)的方法。“倒退”问题是软件开发以及质量控制中最应该避免的错误,它是指在原来的版本中表现完好的某项功能,在后续的版本中缺却突然无法使用或者无法正常工作的现象,这通常是由于在之前能正常工作的版本与最近不能正常工作的版本之间,存在一个或多个有缺陷的源代码提交。我们需要尽早发现“倒退”问题,并尽快定位导致该问题的有缺陷的源代码,这是因为在问题出现的早期通常会很容易定位该问题,但是时间过的越旧,查找它就会越困难。

Bibisect 的简单原理

每个 bibisect 软件包(或者称为 bibisect 仓库)其实都是一个 git 仓库,该仓库中包含了成百上千个(次)从源代码编译的 LibreOffice 二进制程序,这些二进制程序在放入该 git 仓库时是按照对应的源代码提交先后顺序排列的。按照这种方式组织的 LibreOffice 二进制包的集合,是我们在多个版本中定位导致某个“倒退”问题源代码的绝佳方式。有了 bibisect 仓库,我们在测试时不需要每次切换到某个版本之后运行程序时重新编译源代码了。

采用这种方式,我们一方面可以使用 git 本身的二分查找工具(即 git bisect)直接基于二进制程序进行二分查找,另一方面又能受益于 git 对文件系统良好的差分压缩、去重以及文件组织方式。例如,一次完整的 LibreOffice 源代码编译后生成的二进制可执行程序至少会占用500MB磁盘空间,但是如果采用 git, 则虽然第一次添加占用的空间相同,但是后续每次添加产生的增量磁盘空间可能只有25MB大小。

您可以观看一部 Youtube 视频(墙外): Effective Bisection and Bibisection (Matthew Francis 于2015年在LibOCon上的演讲),它介绍并实际演示了使用 bibisect 仓库进行二进制二分查找的过程。

详情

一次成功的“二进制二分查找”(bibisect)会将导致“倒退”问题的可能源代码范围缩小至很少的几个commit,开发者可以从这个小范围内迅速找到引起“倒退”问题的真正“罪魁祸首”。取决于您所使用的 bibisect 仓库,这个范围可能有60个、100个、或者只有2个提交。我们另有一些比较“粗犷”的 bibisect 仓库,使用的是各个已发布版+beta版+rc版,这些仓库中相邻的两次编译可能会跨越几百个源代码 commit 提交。

Bibisect 之后,QA 团队可以进行额外的步骤进行 bisect,从而将范围缩小到某个具体的源代码 commit, 或者将这项任务留给开发者完成。通常情况下,只要进行了成功的 bibisect, 则找到具体的导致“倒退”问题的具体 commit 会非常容易。

使用不到 10G 的 bibisect 仓库,您可以用于成百上千个编译后的 LibreOffice 版本进行测试。通常情况下完成一个 bibisect 二分查找过程只需要不到15分钟。

当前,“二进制二分查找”可在以下操作系统上进行:

常规指导

注意:二分查找的过程在不同的操作系统下会有差异。请阅读上面的链接中针对您的操作系统的指南,那里有非常详细的解释说明、视频以及其他资料。

“二进制二分查找”仅需要6个简单的步骤即可完成:

  1. 搭建环境,包括安装必要的软件。
  2. 下载 bibisect 仓库(其实质是集合了很多 LibreOffice 二进制包的 git 仓库,仓库中的每个commit对应的对 LibreOffice 源代码的一次编译)。
  3. 使用该 bibisect 仓库对 bug 进行二分查找。
  4. 获得二分查找的日志。
  5. 将日志附加到 bug 报告中。
  6. 更新 bug 报告的相应字段。

限制

Performing a bibisect is only possible if we have a repository available for the correct OS, covering the correct range of LibreOffice commits. We have very good coverage on GNU/Linux, and are improving our coverage on Windows and macOS.

Some regressions are difficult to reproduce, and may require multiple test runs for a bug to appear. As you may imagine, trying to bibisect such regressions is very difficult, and requires one to perform many test runs after each checkout of a new version of LibreOffice to give some security / statistics that the bug is indeed present or not present with the given version.

We do not currently have bibisect support for

版本

Bibisect 仓库的版本包含在了不同的操作系统相关的介绍里,请见上面的 #详情 部分。

无法进行 Bibisect 的 bug

有一些 bug 无法进行 Bibisect,这包括:

  • Bugs that don't show up on a supported platform (see #Limitations)
  • Bugs that predate our bibisect builds (We're working on extending the range covered)
  • Bugs that depend upon build options not enabled in the TDF builds (e.g. -kde)

If a bug with bibisectRequest Keyword is found to be not bibisectable, leave a comment on the bug explaining why we're not able to use bibisect to track down the introduction of this problem, and replace Keyword bibisectRequest with notBibisectable.

找到 bug

找到需要进行“二进制二分查找”的 bug

以下包含关键词 bibisectRequest 的 bug 需要进行“二进制二分查找”:

Full Query
ID Summary Priority Status
57373 FILEOPEN: Old Word 95 DOC list input fields not imported since LO 3.5 (OK if saved in MSO as DOC) low NEW
60413 Images in header disappear in Word for Mac OSX after save to Word 97 format medium NEW
62093 VIEWING of preview in Print Dialog destroyed after horizontal or vertical resize medium NEW
69479 Formula is getting corrupted after input medium NEW
75218 Letter Wizard does not respect locale anymore medium NEW
76644 extended tips missing for menu items medium NEW
79452 Themes with a separator line per toolbar incorrectly places separator line at bottom when toolbar docked at bottom low NEW
81894 FORMATTING: Text wrap in a cell prevents spell-check context menu accessibility medium NEW
85094 When printing ODT with mixed portrait and landscape, last page has incorrect orientation medium NEW
87058 Average from Named Range not working as expected, even with hard recalc until save medium NEW
91237 CALC hangs on web table paste (intermittent) high NEW
92909 UI - Table creation field data types are displayed in rounded buttons that do not fill grid cell (OSX only) low NEW
95191 Forms and dialogs opened via macros on ODB file open no longer work high NEW
96176 DRAW: Slow performance zooming an SVG after opening medium NEW
96310 LO will hang for 30 plus seconds after opening EMR software alongside the LO suite (1 processor fully consumed) medium NEW
96341 Version 5.1 takes a lot more RAM than version 5.0 in Windows medium NEW
97129 No feedback while saving a document medium NEW
97616 Calc conditional formatting: fast scrolling down and up shows borders that shouldn't be there low NEW
98491 Split hsqldb Base application will not start under OSX10.11.x causes LO to freeze requiring force kill high NEW
99507 Paste Individual Image From MS Office fails (Paste special as GDI image works and should be default) medium NEW
99602 FILESAVE: subscript in character style not converted into docx medium NEW
99707 Impress stalls presentation on 3-liner text block medium NEW
100119 Korean Autocorrect does not work in OS X 10.11 medium NEW
100961 After inserting Fixed Date, and saving in DOC format, the date is not fixed anymore medium NEW
101379 UI - (on high resolution screens) text cursor is too thin and so nearly invisible medium NEW
101396 VIEWING Font color changes when auto spellcheck is enabled and text is underlined due to spelling error (steps in comment 7) medium NEW
103151 SVG rendered wrong in the presenter console medium NEW
103375 MAILMERGE: unpredictable failures: sometimes looses embedded image, or not all mails sent, when e-mailing as pdf medium NEW
103570 Java not selected automatically when a database is opened for the first time low NEW
103909 macOS: Start Center doesn't open on top - doesn't receive focus high NEW
104716 General performance problems - UI freezes, slow scrolling, etc. in files with big/complex images medium NEW
105690 FILESAVE: Button dissapears after saving in Calc medium NEW
105714 Link dialog icons and fields are too big medium NEW
106484 UI: Print Properties Device tab dropdown items not applied or remembered medium NEW
106617 Writer memory leak medium NEEDINFO
106730 Searching for Character Formatting is Broken medium NEW
106831 Can't print #10 envelopes properly and with proper orientation medium NEW
106962 Clicking text or text box on macOS Sierra results in sluggish UI high NEW
107248 Improvements to the version control dialog medium NEW
107391 FILEOPEN: Images set as 'no wrap' appear floating over text medium NEW
107443 FILEOPEN: "Open" in "Document in Use" dialog for non-default file format documents opens read-only medium NEW
107574 Blue throbbing highlight of comments appear over comment at different window views medium NEW
107987 EDITING: Resizing an image is slow depending on slide design medium NEW
108560 Editing multi-line cells with thousands of words is slow when OpenGL is enabled medium NEW
111874 Regression: glitch in fade->smoothly transition in 5.4 wrt 5.3 (linux, intel graphics) medium NEW
112081 UI: Checkbox labels getting cropped in various language setting options medium NEW
113042 FILESAVE: Saving an large calc sheet is slower in LibO5.4 compared to LibO5.3 medium NEW
113228 Gallery category/folder names not localized medium NEW
113273 Crash in: SfxShell::SetDisableFlags(SfxDisableFlags) medium NEW
113721 One CPU core stuck at 100% after saving a file medium NEW
114272 [macOS] Some Asian characters are garbled with western fonts. medium NEW
114602 Query-Editor: No functions available for Sqlite 3 odbc high NEW
114980 "Preparing preview" for master slides "Recently used" or "Used in this presentation" takes a long time sometimes medium NEW
115077 Merge mail wizard send empty images by mail in HTML format medium NEW
115147 Right pane offset and the appearance was broken when editing charts medium NEW
115907 Index entries are corrupted if the entry is followed by italic and/or superscripted text medium NEW
116547 Export of mathematical formula in Writer document to DOCX is displayed incorrectly in Word medium NEW
117255 EDITING: Star Obj Descr (XML) Resize preview is sometimes inconsistent medium NEW
117742 On format menu, when numbered list is enabled, keyboard navigation is broken medium NEEDINFO
117905 Coinmarketcap api doesn't work anymore medium NEW
118346 Slow performance in Draw with (moderately) complex drawings medium NEW
118530 freeze on inserting an OLE object medium NEW
118603 Temporarily huge memory usage bump when saving a copy of a file (containing HI-res images); release is delayed medium NEW
118667 No heading numbering for the second RTF-paste (when pasting the same content twice) medium NEW
118673 Cross reference category disappears when a comment is placed in the caption category medium NEW
118675 Low image quality when using special paste bitmap of a shape/textbox medium NEW
118748 Accessibility events missing when Calc cells become unselected due to navigating to focused cell medium NEW
119074 FILEOPEN Certain ODT is slow to open (dump vcllo!FontAttributes::IncreaseQualityBy) medium NEW
119081 RTF paste not working when attempting to paste under an embedded table medium NEW
119139 Mysql timestamp fields not displayed in table data entry mode with mysql jdbc-connector high UNCONFIRMED
119171 Some table border formatting is not saved medium NEW
119211 Lines are too long and characters overlap in this Chinese text file medium NEEDINFO
119329 Variable in equation in .docx vanishes if we open the file in Writer (Win-only) medium NEW
119366 FREEZING with long and complex documents medium NEW
119520 The table borders/content shifting when saving with selected content (and afterwards when deselecting) medium NEW
119540 Pasting unformatted text in a fully selected right table cell pastes in both cells. Right one will include hashtags medium NEW
119724 MacOS: Large delay before the red spell checker lines show up after pasting the same content multiple times. Lots of time spend in Scheduler::ProcessTaskScheduling() medium NEW
119818 Right table border disappearing for 1/2 sec when holding space low NEW
119880 Writer 6.1.1 fails to export to PDF a document containing PDF 1.5 images medium NEW
120014 MacOS: Lots of unresponsiveness (beachballs) when enabling automatic spell checking in a large document high NEW
120091 Some LO Base views with conversions or casting on datetime fields causing error message "the data content could not be loaded" with MySQL Connector/J 8 (not with with MySQL Connector/J 5) high NEW
120154 High RAM usage ( around 300mb for 10 mins and drop to 150-200 mb) medium NEW
120157 Toolbars UI - background shading on selected action buttons offset to left of button and smaller than button surface high NEW
120216 Tables make Impress hang medium NEW
120290 Clicking behind a sentence ending in a commented word places cursor before final period medium NEW
120295 A cell with comment text prevent a cell event medium NEW
120358 Long multi-layered numbered list in a table became mis-ordered after some editing medium NEW
120360 Draw extremely slow when table is added medium NEW
120423 LibreOffice Base -> can't insert special character in a form high NEW
120440 Memory usage is increasing rather fast when creating lots of empty documents (45) and pasting a plain text in it medium NEW
120445 File-open ODS: Slower as compared to LibO 4.4.7.2 medium NEW
120516 Word count is starting over and over when typing into a document (causing high CPU usage) medium NEW
120532 Pasting takes a long time to process under certain conditions medium NEW
120539 Position of adjusted middle line on connectors is randomly changed when copying the drawing to a writer document medium NEW
120695 FILEOPEN unixODBC connection to sqlite database not working high NEW
120796 Attempting to open a ".txt" file with Calc selected from Windows explorer "Open with", opens Writer instead medium NEW
121060 LibreOffice gets unresponsive (does not respond) under certain circumstances medium NEW
121062 The time to cut a large amount of text including footnotes has increased from 15 to 24 seconds medium NEW
121086 The first page in print preview shifts to the left when exporting to PDF (visual glitch) (gen) medium NEW
121253 Database wizard opens when press CTRL+A inside the extension manager window high NEW
121532 LO62b1: on macOS local help opens an empty page in default browser high NEW
121554 Crash on file-opening medium NEW
121615 Writer: PDF export of JPEG images from ODT/DOCX stretched and cropped medium NEW
121691 line callout doesn't draw in certain writer documents medium NEW
121698 Saving a document with thousands of comments hangs (GTK3) high NEW
121780 Clear the List of Recent documents -> 'this operation is not supported by operating system' medium NEW
121847 IMPRESS: slide marking on side pane lost when switching to notes view medium NEW
121860 System slows down while marking a lot of single(!) cells by means of Ctrl+Left Mouse Click medium NEW
121996 Crash in: rtl_uStringbuffer_remove when EDITING grid control high NEW
122079 New printer dialog in 6.3+ doesn't detect Automatic Orientation well so page orientation can be changed medium ASSIGNED
122155 Export to many different formats is distorted medium NEW
122264 SUM reports incorrect value medium NEW
122298 Charts in Base-Forms couldn't be changed by macro any more medium NEW
122305 Form-Wizard: No wordwrap in Group Element and Combo Box Wizard for forms. medium UNCONFIRMED
122307 Wizards: Dialog for form elements like list box wizard or group box wizard isn't resizable any more medium NEW
122332 Slowly work of autofilter in 6.2 in comparison by 6.1 medium NEW
122377 FILESAVE: Password protected calc file is slower than non protected file medium NEW
122408 Form couldn't connect to subform (Analyze SQL 'yes') with fields of different data types, which could be connected in queries (GUI and direct SQL). medium NEW
122419 AutoFilter Search Freezes Calc in the Attached Spreadsheet medium NEW
122421 text in table wasn't aligned when opening a RTF file medium NEW
122446 MariaDB native connector: All tables are write protected high NEW
122457 Worse text rendering in newer versions of LibreOffice (OpenGL) medium UNCONFIRMED
122586 Classification: by using the dialog, Watermark text from policy is not placed in the document medium UNCONFIRMED
122593 UI: Focus off. Not able to enter the style name immediately after style creating medium NEW
122600 UI: Creating a new style, doesn't automatically show tab Organize in style dialog medium NEW
122714 Re-expanding the shapes menu of floating window needs a second click medium NEW
122749 Extension Manager freezes after installing oxt on Mac LibreOffice version 6.1.4.2 high NEW
122818 [GTK3] data table edition: the toolbar at the bottom of the window is too narrow high NEW
122820 Outline Presentation object characters are scattered medium UNCONFIRMED

129 Total; 129 Open (100%); 0 Resolved (0%); 0 Verified (0%);


另外,所有的 LibreOffice 中尚未解决的“倒退型” bug,如果能进行“二进制二分查找”的话会很有帮助。

找到已经完成了“二进制二分查找”的 bug

请见 这里.

加入以上信息之后,开发者会知道这个“倒退”问题是在 master 分支源代码提交的 fb754a0df859e30255c25af8fa19bfaa75f257e7 (好) 和 2d19e9bb07ccff3134f855812dddfda5c07b1fe4 (坏) 之间产生的。

如果在源代码 git 仓库中运行以下 git 命令:

git log fb754a0df859e30255c25af8fa19bfaa75f257e7..2d19e9bb07ccff3134f855812dddfda5c07b1fe4

将会显示 128 个提交,其中就包含了造成倒退问题的那个 bug. 这样,开发者就离修复这个 bug 不远了。

更多信息,请参考:

特殊情况

二分查找与特定语言(比如中日韩语言界面)相关的 bug

您要二分查找的 bug 可能与特定的界面语言相关。比如 tdf#115637,这个 bug 在中文界面上能够100%出现,而在英文界面上从来不出现。在这种情况下,因为 TDF 提供的二分查找仓库中默认没有提供任何语言包,只有英文界面,因此如果不进行改进,就无法二分查找这样的 bug。

但是,您可以以下的变通办法:

  • 将系统上现有的正式版本的安装位置,如下的语言资源文件,复制到二分查找仓库的相同位置:
 1. program/resource/<您的语言标记>
 2. share/registry/Langpack-<您的语言标记>.xcd
 3. share/registry/res/fcfg_langpack_<您的语言标记>.xcd
 4. share/registry/res/registry_<您的语言标记>.xcd
  • 重新运行程序,即可看到您需要的语言界面。如果没有更改,请到选项里调出。
  • 开始二分查找。

您需要注意,这种办法无法查找与用户界面翻译有关的 bug,因为自始至终您使用的语言资源是相同的。

以单独的“用户配置文件”运行程序

如果想将用户配置文件放到 /tmp/ 临时目录中(该目录下的所有内容将在系统重启后被删除):

./opt/program/soffice -env:UserInstallation=file:///tmp/soffice-bisect

如果想在每次的二分查找中都让 libreoffice 以全新的用户配置文件启动,那么可以将 git commit 的希哈值附加到文件夹名称中,例如:

./opt/program/soffice \
-env:UserInstallation=file:///tmp/soffice-bisect-$(git rev-parse HEAD)

找到已修复了该问题的 commit 提交

Sometimes a bug is a collateral damage of another (possibly minor) bug, in a non obvious way. In such cases that other bug might be fixed on master, but was not backported to the release branch. You can find the fix, just like finding a bug, except that you need to type

git bisect good

for

git bisect bad

and vice versa. If the fix is small and important enough, it likely can be easily backported to the release branch.

故障排除

Please add your problems and how you solved them. This section covers issues that affect more than one OS. For OS-specific issues, please see the individual OS wiki pages.

无法解压缩文件

If you can't extract files (you should get an error message). Try to rename the file from *.tar.lzma to *.tar.xz.

已安装的 LibreOffice 被未预期地更改

Problem / Messages:

   error: Your local changes to the following files would be overwritten by checkout:
     opt/program/pythonloader.pyc
     opt/program/uno.pyc
     opt/program/unohelper.pyc
   Please, commit your changes or stash them before you can switch branches.
   Aborting

Solutions:

git checkout .

will repair the problem. Afterwards you can start the next test run as usual with

git bisect good # or git bisect bad

If that does not solve the problem, you can try

git clean -fd
git reset --hard

The ultimate repair is to delete everything except one

.git/

hidden folder, and do

git checkout oldest

.


无法启动 soffice

Problem: Upon trying to run soffice within bibisect you receive the error "unexpected operator terminate called after throwing an instance of 'com::sun::star::uno::DeploymentException'

Solution: Reset your libreoffice profile located in ~/.config/libreoffice. Make sure to backup the folder if you have any settings you'd like to preserve for use with your stable libreoffice release. After you're done with bibisect you can try to return your backed up profile to it's original location (ie. delete the new profile folder and replace it with the backed up one)


更多信息

备注

For details on how the bibisect archives are generated:

For information on merging all of our bibisect repositories into one big one, see

We want to make a GUI for bibisect: