QA/Bibisect/ru

    From The Document Foundation Wiki
    < QA
    This page is a translated version of the page QA/Bibisect and the translation is 17% complete.
    Outdated translations are marked like this.

    Введение

    Bibisect означает "деление пополам" и предназначен для помощи членам команды QA LibreOffice занимающихся регрессиями. Регрессия наиболее раздражающий артефакт, который, к сожалению, приходит с разработкой программы. Однако, мы хотим иметь дело с ними как можно раньше, так как их поиск и исправление со временем становятся всё сложнее и сложнее. Git хранит свои вещи так, что одна программа Bibisect может содержать несколько полных 64-разрядных офисных пакетов Linux установленных в очень сжатом размере. И это не требует установки всех версий параллельно, так как можно перейти к любому из них быстро через git checkout source-hash-XXXXXX, что занимает менее 1 секунды.

    If you are new to the topic of bisecting, it is recommended to first complete our tutorial and only then return to this article. Also, while you are free to study the topic independently, mentoring is available for all.

    Ограничения

    При помощи Bibisect возможно находить только те ошибки, для которых в репозитории Bibisect есть в наличии круг подтверждённых вопросов. На сегодняшний день это верно для всех регрессий в Linux. Для macOS и Windows мы медленно приближаемся к цели.

    Если вы не готовы испытывать одну и туже версию LibreOffice несколько раз на одну и туже ошибку, чтобы собрать статистику и обезопасить свои выводы, этот способ не сможет гарантировать нахождение той версии в которой с которой она появилась, тем более если она не 100% воспроизводима.

    Details

    A successful bibisect will find the exact commit that we believe introduced a regression.

    With approximately 10 gigabytes, you'll have thousands of builds to work with. A bibisect can take as little as 15 minutes.

    Currently, bibisecting is possible on these operating systems:

    We also have some very coarse bibisect repositories that use released versions + beta + RC builds, and these may have ranges spanning multiple hundreds of commits.

    General Instructions

    It is a good idea for beginners to start by tracing the steps of a bibisect that was already completed successfully. For this purpose we have a bibisecting tutorial.

    Note pin.svg

    Обратите внимание:
    Each operating system is different, so please read the page that corresponds to your operating system (GNU/Linux, macOS or Windows) for more specific instructions, tips and troubleshooting.

    Короткие инструкции - Только для Linux

    The bibisecting articles for each operating system contain tables listing the available versions. In the "Download links" column of the table you will find links to pages explaining how to acquire the repositories. The repositories for old versions no longer receiving updates are offered as bundles. The repositories for still active versions can be periodically updated with the command git checkout master && git pull.

    If you are testing version 5.x or older, you have to read carefully the article for the operating system you are using and also check the comments column in the Version table. The older versions require various special considerations that this general article does not mention.

    Use the cd (change directory) command in your terminal to move between the different repositories. Jump to the oldest commit in a repository by saying git checkout oldest and to the newest by saying git checkout master. In some older repositories you have to use latest instead of master. Even if the bug report already points out the first version with the bug, always start by testing with both the oldest and the newest commits.

    The commands to launch LibreOffice from the bibisect repositories are as follows in the different operating systems:

    # Windows
    instdir\program\soffice
    </div>
    
    <div lang="en" dir="ltr" class="mw-content-ltr">
    # Linux
    instdir/program/soffice
    </div>
    
    <div lang="en" dir="ltr" class="mw-content-ltr">
    # macOS
    open LibreOffice.app/

    When you don't see the bug in oldest, but do see it in the newest commit, start bibisecting by saying git bisect start master oldest.

    After testing in LibreOffice and seeing the bug, say git bisect bad. If you don't see the bug, say git bisect good. If you were unable to test, say git bisect skip (note that there are various tips related to these scenarios in this and other articles).

    After the final step in the bibisecting process, you are presented with the first bad commit. Within the information given, you are interested in the source hash, which is a combination of letters and numbers. Now you can study the commit to see what it's about and who wrote it. If you have the LibreOffice source code on your computer, you can change to its directory and say git show 22fc8c634c5f9b09d45aff0403503f4d8226328d, the last part being the source hash. Otherwise you can examine the commit in a web browser by creating a URL like so: https://git.libreoffice.org/core/commit/22fc8c634c5f9b09d45aff0403503f4d8226328d

    Now update the bug report as follows (can be done in a single change):

    1. Write a comment mentioning the bibisect repository you used and the source hash (it will become a link in Bugzilla automatically). Any other useful information is welcome, of course.
    2. Update the Version field, if needed (see also #Finding the earliest version affected
    3. Replace the keyword bibisectRequest with bibisected and bisected (only include the last one, if you found the exact commit and not just a range of commits)
    4. Add the name of the commit author to the Regression By field (for this you need contributor rights in Bugzilla)
    5. Add the commit author to the CC List of the report

    Версии

    Commit ranges

    Репозиторий 43all должен включать все предыдущие и поэтому они могут считаться устаревшими[1].

    Платформа Версия Серия фиксаций (commit) от Серия фиксаций (commit) до Количество фиксаций (commit) Количество сборок Ссылка на загрузку Размер загрузки Bibisected bugs in range Коментарии
    Ubuntu 12.04 x64 43all d6cde02d c15927f2 60733 755 builds Canonical: репозиторий подпись 12Gb 542+[2] это заменяет старый репозиторий 42all[3]
    43only 22029c7e c15927f2 13951 220 builds Canonical: репозиторий подпись 3.6Gb только в диапазоне от точки ветвления 4.2 до 4.3[4]
    Ubuntu 14.04 x64 44alpha2only dea4a3b9 b800d0b6 9859 188 builds Canonical: репозиторий подпись 2.8 Gb только в диапазоне от разделения ветки 4.3 до тега alpha2 4.4
    macOS
    • lo-4.1_to_lo-4.2
    • 4.2_to_lo-4.3
    • и release_lo-3.3.0_to_lo-4.1
    ? ? ? ? TDF: репозиторий 6 GB, 3.9GB and 2GB пробная?
    WIN 2013-12-13_2013-12-19 ? ? ? ? TDF: репозиторий 3.5GB не активна, только для тестирования
    Linux dbgutil более поздняя точка ветвления libreoffice-x-y -> более поздний master TDF: репозиторий 2.6 GB dbgutil[5]

    git log -2 c3f9dc54188b316a61dd871b63734d49b05f5d7f

    Now you can copy the source hashes of the first and previous displayed commits and separate them with .. to construct a range query like so:

    https://git.libreoffice.org/core/log/7c4d3ea6ba4d42b4dda5148a00c8c411b5d7703d..5b195fbcf7a441aeb193f6abd08b877e580938e0
    

    This will allow you to skim commit messages looking for related subjects. For deeper scrutiny, see the section on detective work.

    Finding the earliest version affected

    If you have a local copy of the core repository, you can update the Version field in the bug report thanks to some git commands:

    1. First, make sure you have all the tags:

    git fetch --tag

    2. Then, use `name-rev` to find the context (more precisely, by how many revisions it preceded the earliest tag that contains the commit):

    git name-rev <commit>

    3. If that didn't give a useful tag that matches a LibreOffice version, you can list all tags that contain the commit and have "libreoffice" in the name with:

    git tag --contains <commit> | grep libreoffice

    Limitations

    Performing a bibisect is only possible if we have a repository available for the correct OS, covering the correct range of LibreOffice commits.

    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

    Во-первых, вы должны инсталлировать Linux 64-bit. Инсталляция в виртуальной машине тоже будет работать.

    Distro 43all 43only
    Ubuntu 13.10 (Saucy) необходимо установить libjpeg62 для включены версий старше 3.5 может работать установленный по умолчанию
    Ubuntu 12.04 LTS (Precise) необходимо установить libjpeg62 для включены версий старше 3.5 может работать установленный по умолчанию
    openSUSE 12.1 нет ?
    Fedora собрать libjpeg8 из исходного кода и установить LD_PRELOAD (для версий старше 3.5) ?
    • Bugs that don't show up on a supported platform (see #Limitations)
    • Bugs that predate our bibisect builds
    • Bugs that depend upon build options not enabled in the TDF builds

    Затем установите зависимости для вашего дистрибутива:

    > sudo apt-get install git libjpeg62 # ubuntu
    

    Затем, скачайте архив bibisect (выбрать здесь) и распакуйте его. Для 42all команда распаковки выглядит как:

    > tar -xf bibisect-42all.tar.xz
    

    Вы также можете проверить подлинность и целостность файлов. Для этого вам понадобится GPG-ключ с https://launchpad.net/~bjoern-michaelsen. Для примера,

    > gpg --keyserver keyserver.ubuntu.com --recv-keys XXXXXXXX # замените XXXXXXXX на OpenPGP ключ с веб-страницы
    > gpg --verify bibisect-42all.tar.xz.sig
    

    Первое скачивание будет занимать несколько гигабайт (12 гигабайт для 43all). Обновления занимают меньше места.

    Поиск места появления регрессии в LibreOffice

    Finding bugs needing bibisect

    If you are new to bibisecting, click the Id column header until the list is sorted from highest Id to lowest. Compared to newer ones, when bibisecting older issues you will run into more surprises and greater complexity.

    The following bugs with keyword bibisectRequest are waiting for a bibisect:

    In addition all unresolved regressions in LibreOffice might benefit from bibisecting.

    Выбор ошибки

    Выберите ошибку нуждающуюся в поиске при помощи Bibisect

    Следующие ошибки в поле whiteboard с записью bibisectrequest ожидают обработки:

    <rss>https://bugs.documentfoundation.org/buglist.cgi?list_id=145560&product=LibreOffice&query_format=advanced&status_whiteboard=bibisectrequest&status_whiteboard_type=allwordssubstr&title=Bug%20List&ctype=atom&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED</rss> Открыть этот лист в Bugzilla

    Кроме того, для всех нерешенных регрессий в LibreOffice можно попытаться использовать bibisecting.

    Поиск ошибок уже прошедших проверку на Bibisect

    Ссылки на запросы в Bugzilla смотрите тут.

    С учетом указанной выше информации добавленой к ошибке разработчик знает, что регрессия появилась между фиксациями fb754a0df859e30255c25af8fa19bfaa75f257e7 (good) and 2d19e9bb07ccff3134f855812dddfda5c07b1fe4 (bad) в мастере.

    > git log fb754a0df859e30255c25af8fa19bfaa75f257e7..2d19e9bb07ccff3134f855812dddfda5c07b1fe4
    

    В репозитории исходного кода будет показано 128 фиксаций в том числе та, которая спровоцировала ошибку. Это сильно облегчает поиск для разработчиков, и ускоряет исправление ошибки.

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

    Подробнее можно посмотреть:

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

    Finding a fix

    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. To identify a problem-fixing commit you can use:

    git bisect start --term-new=fixed --term-old=unfixed
    git bisect fixed master
    git bisect unfixed <some-old-sha> # you can use "git log --reverse" to detect the first revision in the bibisected package

    As you test, say

    git bisect fixed
    or
    git bisect unfixed
    as appropriate.

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

    Checking out a specific commit based on source hash

    Sometimes you already know a specific source commit has/does not have the bug you are hunting.

    Copy the source hash from the LibreOffice git history and use it to grep in the bibisect repo log like so:

    git log --all --grep='29a9f433c268414747d8ec7343fc2b5987971738'

    Copy the commit hash of the bibisect repo and do a checkout for it to verify your assumption:

    git checkout 38758b70f5278d4d8292a2e857e80a9a1130f38e

    You can use the repo commit hash when determining the bad-good range to bisect:

    git bisect start 38758b70f5278d4d8292a2e857e80a9a1130f38e oldest

    Doing detective work inside a commit range

    In case your bibisect result is a range of commits and you have trouble locating the offending commit, you might make your life easier by searching with a keyword.

    An example for a case, where we know the problem is in Calc's Navigator view:

    git log --stat --pretty=short --graph 169bd7718264b0e312052757f9bbd2321e1399c2...ff8b873936aa72b17309da4bfc2775573a5b1f55 | grep -B 10 -A 10 --color=always "sc/source/ui/navipi" | less -R

    Adjust the -B and -A grep parameters to control how many lines before and after the hit you want to display. When piping to less, -R preserves the colouring of search results.

    This method can also be used as a shortcut in a situation, where you find yourself having to use git bisect skip over and over again due to some broken functionality.

    If soffice is failing with a non-zero exit code - this probably means a crash - a solution under QA/Bibisect/Automation#Tidbits for efficiency offers a script to ease the pain of repeatedly skipping failed probes.

    Especially in the older repositories, sometimes you can end up with a list of dozens of potential bad commits. The commits might not be in order, so it is not easy to construct a range query. You can save the list of commits to a text file and run git show for all of them, directing the output to a file:

    while IFS="" read -r p || [ -n "$p" ]
    do
      git show --no-patch "$p" >> /path/to/bisectlog.txt
    done < /path/to/bisect_range.txt

    The older repositories include the original commit message, so this resulting log file will be immediately useful. If the binary repository doesn't include the original messages, you have to first do a pass with git show --oneline --no-patch, tidy up the list of source hashes and then do the final looping against LibreOffice core repository.

    Finding source commits from bibisect

    If bibisect was done, but not likely to be correct or in a repository known to have large range of source commits, we can check the range by finding a previous build commit from the found one and then find the source range.

    $ git log -1 1f14665c5624bc7a502738aa8f4f2bd70a211e72^
    $ git log --oneline b6c016da23d309b4ac7d154bc33a22397974ed73..d85fd8a85501547d5bb87822d2589a07aed7f2d6

    Особые ситуации

    Работа в отдельном профиле пользователя

    Чтобы создать отдельный каталог пользователя в /tmp/ (который будет автоматически удалён при следующей перезагрузке системы):

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

    Если вы хотите, чтобы каждый запуск программы создавал новый каталог с хэш-кодом фиксации git, вы можете добавить в конец имени каталога $(git rev-parse HEAD). Для примера:

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

    Finding a fix

    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
    

    Иногда ошибка неочевидным путём является побочным эффектом другой (возможно маленькой) ошибки. В таких случаях ошибка может быть исправлена на ветке master, но не внесена в основную ветку. Вы можете найти исправление таким же способом как и ошибку, кроме того, что вам нужно вводить git bisect good за git bisect bad и наоборот. Если исправления небольшие и достаточно важные, это может легко быть перенесено в основную ветку.:

    git checkout .
    
    # <span lang="en" dir="ltr" class="mw-content-ltr">Sometimes this more specific command is needed:</span>
    find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf;

    The above command 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 the following commands:

    git clean -fd
    git reset --hard

    The ultimate repair is to delete everything except one hidden .git/ folder, and do

    git checkout oldest

    Unable to start soffice

    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. 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 the bibisect you can try to return your backed up profile to its original location (ie. delete the profile folder and replace it with the backed up one)

    How to bisect RTL bugs

    In case you need to bisect a RTL ( Right-To-Left ) bug, run LibreOffice with this environment variable (see the link to learn how to use environment variables on different platforms):

    SAL_RTL_ENABLED=1

    How to bisect File Recovery bugs

    In case you need to bisect File Recovery bugs ( e.g. tdf#129210 ), comment out line OOO_DISABLE_RECOVERY=1 in file instdir/program/ooenv

    You may also use user control:

    soffice --norestore file-that-recovers.ext

    How to bisect file hanging / CPU or memory exhaustion bugs

    In case you need to bisect file hanging/memory exhaustion bugs, you may limit memory or CPU or time execution.

    In Linux, timeout utility can be used. To avoid confusion with built-in "timeout" command, here it's renamed to "tmt".

    For example, if LibreOffice 'good' commit opens a file with 1 GB of memory, you may set soffice memory limit to 1.500.000 kilobytes to avoid 'bad' commit hanging your computer.

    tmt -m 1500000 instdir/program/soffice

    Or, to limit CPU+SYS time (where normal time is seen with successful run):

    tmt -t 20 instdir/program/soffice

    More advanced option is to use benchexec utility. User needs to be added to the appropriate group (benchexec). Runexec can be used to execute a single command while measuring its resource consumption, similarly to the tool "time" but with more reliable time measurements and with measurement of memory usage.

    In Windows, process-governor utility can be used.

    Дополнительная информация

    Automation

    See the separate article on automating bisecting.

    Примечания

    • QA/Bibisect/Implementation - подробная информация о создании архивов для bibisect;
    • Bibisectzilla - информации о слиянии всех наших bibisect
    1. Могут быть до сих пор доступны на http://people.canonical.com/~j-lallement/libreoffice/binrepo/
    2. другие 250+ ошибок упоминаются в bibisect, но не имеют тегов. Возможно, просто забыли пометить
    3. сейчас хранится в http://people.canonical.com/~bjoern/bibisect/bibisect-42all.tar.xz , но скоро будут удалены как устаревшие
    4. он один заменяет оба следующие, более мелкие репозитории: в диапазоне от 4.2 до alpha1 и в диапазоне от alpha1 до точки ветвления 4.3 -- скорее всего, будет удален в ближайшее время
    5. Бьорн (Bjoern) создаёт постфактум репозиторий (после создания меток alpha или после ответвления) в автоматическом и понятным способом, с оптимизацией (например, отключением SDK). Миклош (Miklos) создаёт репозиторий на ежедневной основе (отсюда и название) из уже фрагментированной сборки. Поэтому его сборки в долгосрочной перспективе, вероятно, менее полезно (пока вы не охотитесь на проблемы dbgutil). Однако они очень полезны при отслеживании ошибок, которые произошли, например, на прошлой неделе, если меток в репозитории ещё не было. Это также значит, что если вы клонируете упоминаемый репозиторий через несколько дней после ответвления, он содержит только несколько фиксаций (commit). В этом случае вам может быть интересны старые версии. Это также причина, почему число в столбце размера постоянно изменяется.