Crates.io | paketkoll |
lib.rs | paketkoll |
version | 0.3.7 |
source | src |
created_at | 2024-02-26 19:16:32.151349 |
updated_at | 2024-09-20 18:20:40.326191 |
description | Check installed distro files for changes |
homepage | |
repository | https://github.com/VorpalBlade/paketkoll |
max_upload_size | |
id | 1154048 |
size | 84,559 |
[ lib.rs ] [ crates.io ] [ AUR ]
This is a Rust replacement for debsums
(on Debian/Ubuntu/...) and paccheck
(on Arch Linux and derivatives). It is much faster than those thanks to using
all your CPU cores in parallel. (It is also much, much faster than pacman -Qkk
which is much slower than paccheck
even.)
What it does is compare installed files to what the package manager installed and report any discrepancies.
Additional features:
/etc
as one might think).--trust-mtime
to not check the contents of files
where the mtime matches. This makes the check ultra-fast.paketkoll check-unexpected
, though some work is required,
since there are many legitimately unmanaged files. You may need to find a set
of --ignore
flags suitable for your system. Only some simple basics ignores
are built in (/proc
, /sys
, /home
, etc.).Caveats:
paccheck
(3x). This is largely unavoidable due
to memory-speed tradeoffs, though there is room for some improvements still.paccheck
. For example, if
it finds that the size differs, it will not bother computing the checksums,
since they can never match.Note: CPU time is actually comparable to the original tools (slightly better in
general). But due to parallelism the wall time is way better, especially
without --trust-mtime
(where the runtime is quite small to begin with).
pacman -Q | wc -l
indicates 2211 packages installedWhen only checking file properties and trusting mtime (these should be the most similar options):
$ hyperfine -i -N --warmup 1 "paketkoll --trust-mtime check" "paccheck --file-properties --quiet"
Benchmark 1: paketkoll --trust-mtime
Time (mean ± σ): 249.4 ms ± 4.8 ms [User: 1194.5 ms, System: 1216.2 ms]
Range (min … max): 242.1 ms … 259.7 ms 12 runs
Benchmark 2: paccheck --file-properties --quiet
Time (mean ± σ): 2.561 s ± 0.020 s [User: 1.504 s, System: 1.053 s]
Range (min … max): 2.527 s … 2.598 s 10 runs
Warning: Ignoring non-zero exit code.
Summary
paketkoll --trust-mtime ran
10.27 ± 0.21 times faster than paccheck --file-properties --quiet
The speedup isn't quite as impressive when checking the checksums also, but it is still large:
$ hyperfine -i -N --warmup 1 "paketkoll check" "paccheck --sha256sum --quiet"
Benchmark 1: paketkoll
Time (mean ± σ): 9.986 s ± 1.329 s [User: 17.368 s, System: 19.087 s]
Range (min … max): 8.196 s … 11.872 s 10 runs
Benchmark 2: paccheck --sha256sum --quiet
Time (mean ± σ): 68.976 s ± 0.339 s [User: 16.661 s, System: 17.816 s]
Range (min … max): 68.413 s … 69.604 s 10 runs
Warning: Ignoring non-zero exit code.
Summary
paketkoll ran
6.91 ± 0.92 times faster than paccheck --sha256sum --quiet
dpkg-query -l | grep ii | wc -l
indicates 749 packages installed$ hyperfine -i -N --warmup 1 "paketkoll check" "debsums -c"
Benchmark 1: paketkoll
Time (mean ± σ): 2.664 s ± 0.102 s [User: 3.937 s, System: 1.116 s]
Range (min … max): 2.543 s … 2.813 s 10 runs
Benchmark 2: debsums -c
Time (mean ± σ): 8.893 s ± 0.222 s [User: 5.453 s, System: 1.350 s]
Range (min … max): 8.637 s … 9.199 s 10 runs
Warning: Ignoring non-zero exit code.
Summary
'paketkoll' ran
3.34 ± 0.15 times faster than 'debsums -c'
dpkg-query -l | grep ii | wc -l
indicates 4012 packages installed$ hyperfine -i -N --warmup 1 "paketkoll check" "debsums -c"
Benchmark 1: paketkoll
Time (mean ± σ): 5.341 s ± 0.174 s [User: 42.553 s, System: 33.049 s]
Range (min … max): 5.082 s … 5.586 s 10 runs
Benchmark 2: debsums -c
Time (mean ± σ): 92.839 s ± 7.332 s [User: 47.664 s, System: 15.697 s]
Range (min … max): 82.872 s … 103.710 s 10 runs
Warning: Ignoring non-zero exit code.
Summary
paketkoll ran
17.38 ± 1.49 times faster than debsums -c
Most future improvements will happen in the konfigkoll
crate, to make it suitable for another project idea I have (basically that project
needs this as a library).
I consider the program itself mostly feature complete. The main changes would be bug fixes and possibly supporting additional Linux distributions and package managers.
The MSRV may be bumped as needed. It is guaranteed that this program will at least build on the current stable Rust release. An MSRV change is not considered a breaking change and as such may change even in a patch version.
paketkoll is Swedish for "package check", though the translation to English isn't perfect ("ha koll på" means "keep an eye on" for example).