I had created a dpkg local diversion using the command -
dpkg-divert --divert /etc/PackageKit/20packagekit.distrib --rename /etc/apt/apt.conf.d/20packagekit
The output of the command "dpkg-divert --list" command is now -
diversion of /usr/share/dict/words to /usr/share/dict/words.pre-dictionaries-common by dictionaries-common
diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash
local diversion of /etc/apt/apt.conf.d/20packagekit to /etc/PackageKit/20packagekit.distrib
diversion of /usr/bin/firefox to /usr/bin/firefox.real by firefox-esr
diversion of /bin/sh to /bin/sh.distrib by dash
When I run cruft-ng version 0.4.52 on the system it crashes with Segmentation fault
Below is the relevant part of the output (in gdb, with DEBUG variable set to 1)
Note that the output of "dpkg-divert --list" does not show a package name for the local diversion. The code parsing the output in dpkg_open() always assumes that there is one. (If the dpkg local diversion is removed, cruft-ng completes successfully)
...
READING FILES IN DPKG DATABASE
[Detaching after vfork from child process 104913]
diversion of /usr/share/dict/words to /usr/share/dict/words.pre-dictionaries-common by dictionaries-common
diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash
local diversion of /etc/apt/apt.conf.d/20packagekit to /etc/PackageKit/20packagekit.distrib
Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-vec.S:133
Download failed: Invalid argument. Continuing without source file ./string/../sysdeps/x86_64/multiarch/strlen-vec.S.
133 ../sysdeps/x86_64/multiarch/strlen-vec.S: No such file or directory.
(gdb) bt
#0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-vec.S:133
#1 0x0000555555568e8c in std::char_traits<char>::length (__s=0x0)
at /usr/include/c++/11/bits/char_traits.h:399
#2 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign (__s=0x0, this=0x7fffffffcb20)
at /usr/include/c++/11/bits/basic_string.h:1459
#3 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (__s=0x0, this=0x7fffffffcb20)
at /usr/include/c++/11/bits/basic_string.h:690
#4 read_diversions (diversions=std::vector of length 2, capacity 2 = {...})
at ./dpkg_popen.cc:66
#5 0x00005555555696ee in read_dpkg_items (
dpkg=std::vector of length 0, capacity 0) at ./dpkg_popen.cc:83
#6 0x0000555555558b5d in main (argc=<optimized out>, argv=<optimized out>)
at ./cruft.cc:258
(gdb)
cruft-ng segfaults for me as well:
...
READING FILES IN DPKG DATABASE
[Detaching after vfork from child process 363152]
diversion of /usr/share/man/man1/perf.1.gz to /usr/share/man/man1/perf.wrapper.1.gz by linux-perf
diversion of /usr/share/dict/words to /usr/share/dict/words.pre-dictionaries-common by dictionaries-common
diversion of /usr/share/bash-completion/completions/perf to /usr/share/bash-completion/completions/perf.wrapper by linux-perf
diversion of /usr/bin/shasum to /usr/bin/shasum.bundled by libdigest-sha-perl
diversion of /usr/share/man/man1/podselect.1.gz to /usr/share/man/man1/podselect.bundled.1.gz by libpod-parser-perl
local diversion of /usr/share/applications/calibre-ebook-viewer.desktop to /usr/share/applications/calibre-ebook-viewer.desktop.distrib
Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
Download failed: Invalid argument. Continuing without source file ./string/../sysdeps/x86_64/multiarch/strlen-avx2.S.
74 ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) where
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
#1 0x0000555555568e8c in ?? ()
#2 0x00005555555696ee in ?? ()
#3 0x0000555555558b5d in ?? ()
#4 0x00007ffff7a4a81d in __libc_start_main (main=0x555555558870, argc=1,
argv=0x7fffffffde98, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffde88)
at ../csu/libc-start.c:332
#5 0x000055555555aefa in ?? ()
(gdb)
We believe that the bug you reported is fixed in the latest version of
cruft-ng, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1010362@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Alexandre Detiste <alexandre.detiste@gmail.com> (supplier of updated cruft-ng package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 17 Jul 2022 01:25:30 +0200
Source: cruft-ng
Architecture: source
Version: 0.4.53
Distribution: unstable
Urgency: medium
Maintainer: Alexandre Detiste <alexandre.detiste@gmail.com>
Changed-By: Alexandre Detiste <alexandre.detiste@gmail.com>
Closes: 1010362
Changes:
cruft-ng (0.4.53) unstable; urgency=medium
.
* Fix segmentation fault when custom dpkg overrides are defined
(Closes: #1010362)
Checksums-Sha1:
55f5ecb22ce915119476b9cf3c85ea82b711dbb4 1569 cruft-ng_0.4.53.dsc
ed2372026189be9efe41bd60a8754aa54804d2ed 19608 cruft-ng_0.4.53.tar.xz
751423a238198434cd6ce876629c644593c179e1 6121 cruft-ng_0.4.53_source.buildinfo
Checksums-Sha256:
7bb6ed3fee7a0d84f4c25c970389e2384b9f8dacfb957019daefe1c0d8e3aeab 1569 cruft-ng_0.4.53.dsc
6106571d111df5667eb0c4fc56c7a9e0fdd54be0fd412eecd472b40e33cfb717 19608 cruft-ng_0.4.53.tar.xz
26b2bca985a393ff0e6ab87ff62467b1670f29001b87b7019e39a8ae94f8db9b 6121 cruft-ng_0.4.53_source.buildinfo
Files:
2ccd36fa03bc7b23efff817753e62d5d 1569 admin optional cruft-ng_0.4.53.dsc
d73c417049614c3d42ea212596f07d89 19608 admin optional cruft-ng_0.4.53.tar.xz
67be78bc840db38ad843d2db59c24fdb 6121 admin optional cruft-ng_0.4.53_source.buildinfo
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEj23hBDd/OxHnQXSHMfMURUShdBoFAmLTSP4ACgkQMfMURUSh
dBpnUBAAvSyaizLTpkuNhlMZfi0VcxFKDxESQeHso1FGWLFS6rHZPANGXkL/Z9kq
Km5KH6wm7NLyAOXNBk2jcE39Imt+j6JC5Q9zdRQC5zIRV04k4wrTFRFKFN7o4aDY
U1UBdXyPCtuG8hJ+abNs2qGdmyh0+WoI3J6plq8HtLm4yptqk6yMdsSI5/uWCmUn
CfqQ7BpUYjZtmXlpqVGyF1V3eDNvbHiWOJlIIwe6TKlXXHthk8O9slCIDcLwbFeO
Z3Xdd+DpTKuMlJJ8GQ3Ys9PPwOd1JZm/Lv7fahNdr7PAzRZhI5fcthVyt/FmB4Rj
NnN6vscqkfgTaLZaBHv+ENS95dLkLT2HMvmBsUGtYkCTU/oyJbgJqRl0AbhyqefQ
DszHl6/1SrGnHxOi84U3gnX2HojhOqoakfFR6P9FLzD4r0Gn+INF4ZkQYoQPhlL/
jEER3Mnxn++npcSgYjDrRAgiVu7tEeWhxQxMG3l3qTuQiHlMz50JAZ13H4sY0/X6
0u7e0yQTV19RoZyCZ5E90hxCNzjPu6AN2RvWLljxJbTrx+wQboUczw/nVhTVAHMI
C28HIi59Gjk4Wc26osxvGt7bgMpbl/kvPhvYwaaNeN4IgUGGo58jVXT7OzYcjKJd
JxQ9DhDD5toaxFep5jv3wjSi+zgVXrlSFxANr3UDuG1DFxYjJU8=
=fC/0
-----END PGP SIGNATURE-----