Herodotus: Difference between revisions

From ALT Linux Wiki
(→‎How to try herodotos: not the outdated aosd10 example)
m (→‎How to try herodotos: more consistent formatting)
Line 69: Line 69:
  $ gear-hsh  --apt-config=/home/imz/.hasher/p8/apt.conf --without-stuff 2>&1 | tee hsh.log.1
  $ gear-hsh  --apt-config=/home/imz/.hasher/p8/apt.conf --without-stuff 2>&1 | tee hsh.log.1


:It stops after the step of applying the static analyzer ({{prg|coccinelle}}) to each version of the sources (linux). The results are saved at {{path|/usr/src/HERODOTOS/}} (inside hasher). I've copied them and saved in [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=commitdiff;h=ad458b0c2b24e92cc09c4f2043e6021bb0d2af05 commit ad458b0c2] in the [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=shortlog;h=refs/heads/EXPERI/imz2/apply-analyzer-results EXPERI/imz2/apply-analyzer-results] branch, so that you can look and get an idea what they look like: the individual per-version {{path|*.orig.org}} files.
:It stops after the step of applying the static analyzer ({{prg|coccinelle}}) to each version of the sources (linux). The results are saved at {{path|/usr/src/HERODOTOS/}} (inside hasher). I've copied them and saved in [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=commitdiff;h=ad458b0c2b24e92cc09c4f2043e6021bb0d2af05 commit ad458b0c2] in the [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=shortlog;h=refs/heads/EXPERI/imz2/apply-analyzer-results EXPERI/imz2/apply-analyzer-results] branch, so that you can look and get an idea what they look like:
 
:* the individual '''per-version {{path|*.orig.org}} files'''.


:{{path|/usr/src/HERODOTOS/}} is used as the place to cache the analyzed sources and to save the (intermediate and final) results, so it won't be cleaned if you run {{cmd|gear --hasher | hsh-rebuild}} again (after editing the Git repo with the Makefiles, configs etc).
:{{path|/usr/src/HERODOTOS/}} is used as the place to cache the analyzed sources and to save the (intermediate and final) results, so it won't be cleaned if you run {{cmd|gear --hasher | hsh-rebuild}} again (after editing the Git repo with the Makefiles, configs etc).
Line 85: Line 87:
:I saved the results in [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=commitdiff;h=c3f5e56dd7ecc9a9c7bc70379bc05f1a0c6be1b6 commit c3f5e56dd7e] in the [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=shortlog;h=refs/heads/EXPERI/imz2/correl-gnudiff-results EXPERI/imz2/correl-gnudiff-results] branch, so that you can look and get an idea what they look like:
:I saved the results in [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=commitdiff;h=c3f5e56dd7ecc9a9c7bc70379bc05f1a0c6be1b6 commit c3f5e56dd7e] in the [http://git.altlinux.org/people/imz/public/faults-in-Linux.git?p=faults-in-Linux.git;a=shortlog;h=refs/heads/EXPERI/imz2/correl-gnudiff-results EXPERI/imz2/correl-gnudiff-results] branch, so that you can look and get an idea what they look like:


:* some non-empty {{path|*.correl.org}} files with undecided possible correlations (marked as <code>TODO</code>);
:* some non-empty '''{{path|*.correl.org}} files with undecided possible correlations''' (marked as <code>TODO</code>);
:* the {{path|*.new.org}} files with merged warnings from all versions. It is to be decided whether each of them is a real error or a false warning. (Marked as <code>TODO</code>.)
:* the '''{{path|*.new.org}} files with merged warnings from all versions'''. It is to be decided whether each of them is a real error or a false warning. (Marked as <code>TODO</code>.)


:(In this example, I made {{prg|herodotos}} use the {{cmd|--diff gnudiff}} option, because the default better {{cmd|--diff hybrid}} requires {{prg|gumtree}} and doesn't work correctly if it is absent.)
:(In this example, I made {{prg|herodotos}} use the {{cmd|--diff gnudiff}} option, because the default better {{cmd|--diff hybrid}} requires {{prg|gumtree}} and doesn't work correctly if it is absent.)

Revision as of 02:30, 30 October 2018


(It's a work in progress.)

Herodotus is a project for tracking and linking analytic and synthetic facts about (the releases of) a package. The tracking is to be done independently per package. (Sisyphus is an example of a repository of packages where this can be applied.)

(Herodotus is inspired by, and partly based in the implementation, on herodotos tool. Note the different spelling of the name of this tool and of our project. Named after Herodotus.)

Which computed or external meta-information for a package is tracked
  • Analytic facts (computed from the "internal" content of package releases):
  • Static analysis of the C/C++ code (warnings):
  • by coccinelle
  • by cppcheck
  • ...
  • Discovery of source files which are not used during the build of the package (by means of strace or by the access time)
  • ...
  • Synthetic facts (added "externally" by maintainers)
  • Resolutions for the warnings from the static analysis (a reason why they are invalid or a fix).
  • ...
Representation
  • Each fact is linked to the corresponding Git (Gear) commit or tag.
  • (The facts can be stored in the same Git repository in a separate branch.)
  • If the "same" fact appears for several releases, all its occurrences are linked together, so that a maintainer can view them as a single fact. Only when the facts change between releases, it should need attention.
User interfaces
  • Files (obtained via Git), org-mode editor (Emacs; org-mode is like a personal wiki)
  • ...

Implementation details

The core: herodotos tool

herodotos tool runs the analyzers for different releases and then links identical facts (modulo the diff, i.e., the changes of the source code).

Description of herodotos tool

herodotos in Sisyphus

requires:

How to try herodotos

One can install herodotos (for p8) from task 214330.

If you want to try herodotos, try to reproduce the authors' work https://github.com/coccinelle/faults-in-linux . (It is more recent; the older work http://coccinelle.lip6.fr/papers/aosd10.pdf with their data and configuration is not suitable for the current herodotos 0.8+ version.)

I've adapted their herodotos config files and made it a Gear repo: http://git.altlinux.org/people/imz/public/faults-in-Linux.git , so that one can easily pass it to hasher and do the processing in an isolated, easily reproducible hasher environment.

  • First, prepare: clone my repo and and set up the sources for APT:
$ git clone --depth=20 git://git.altlinux.org/people/imz/public/faults-in-Linux.git
$ cd faults-in-Linux
$ apt-repo  --hsh-apt-config=/home/imz/.hasher/p8/apt.conf add 214330
Here is what the APT sources config for the hasher should be like (and our current working dir):
$ apt-repo  --hsh-apt-config=/home/imz/.hasher/p8/apt.conf
rpm [updates] file:/ALT/p8 x86_64 classic
rpm [updates] file:/ALT/p8 noarch classic
rpm http://git.altlinux.org repo/214330/x86_64 task
$ pwd
/space/home/imz/wip/2018-10-herodotos-cppcheck/faults-in-Linux
  • Then, we execute the authors' processing rules (under the control of my .gear/faults-in-Linux.spec-file from the master branch; it automatically gets and checks out various revisions of the linux sources (so, you must have enough space to hold it):
$ export share_network=1
$ gear-hsh  --apt-config=/home/imz/.hasher/p8/apt.conf --without-stuff 2>&1 | tee hsh.log.1
It stops after the step of applying the static analyzer (coccinelle) to each version of the sources (linux). The results are saved at /usr/src/HERODOTOS/ (inside hasher). I've copied them and saved in commit ad458b0c2 in the EXPERI/imz2/apply-analyzer-results branch, so that you can look and get an idea what they look like:
  • the individual per-version *.orig.org files.
/usr/src/HERODOTOS/ is used as the place to cache the analyzed sources and to save the (intermediate and final) results, so it won't be cleaned if you run gear --hasher again (after editing the Git repo with the Makefiles, configs etc).
  • The next step (correlation of the warnings between versions by herodotos) is to be run by us manually (because I wanted to have a possibility to first commit the results of the previous step):
hsh-shell --mount=/proc,/dev/pts
cd /usr/src/RPM/BUILD/faults-in-Linux-20181023/faults/
make correl
or as a single command:
hsh-run --mount=/proc -- sh -c 'cd /usr/src/RPM/BUILD/faults-in-Linux-20181023/faults/ && make correl'
I saved the results in commit c3f5e56dd7e in the EXPERI/imz2/correl-gnudiff-results branch, so that you can look and get an idea what they look like:
  • some non-empty *.correl.org files with undecided possible correlations (marked as TODO);
  • the *.new.org files with merged warnings from all versions. It is to be decided whether each of them is a real error or a false warning. (Marked as TODO.)
(In this example, I made herodotos use the --diff gnudiff option, because the default better --diff hybrid requires gumtree and doesn't work correctly if it is absent.)

coccinelle support

coccinelle is natively supported by herodotos tool.

Actually, herodotos tool can work with any analyzer which gives output in the org-mode format.

coccinelle in Sisyphus

cppcheck support

  • cppcheck is supported by flycheck (an Emacs package)
  • flycheck can be hacked to output the information in the format suitable for herodotos tool (org-mode)

So, we could easily get the support for any analyzer known to flycheck.

cppcheck in Sisyphus

  • Symbol support vote.svg cppcheck
  • Symbol oppose vote.svg emacs-mode-flycheck
  • Symbol oppose vote.svg flycheck output in org-mode format

Discovery of source files which are not used during the build of the package

Either builds under strace can be used to discover files which are not used, or the access time (an idea by boyarsh@, which has already been probably implemented by him).

Usage

(to be written)