pacutils
pacutils copied to clipboard
paccheck crashes on ArchLinux32
This happens with the version from this repo as well as from the Arch32 package.
$ src/paccheck pacman
pacman: all dependencies satisfied
zsh: segmentation fault (core dumped) src/paccheck pacman
Analysis with gdb:
(gdb) bt
#0 0xb7d1989a in strnlen () from /usr/lib/libc.so.6
#1 0xb7d197ac in strncpy () from /usr/lib/libc.so.6
#2 0x0040332b in check_files (pkg=0x427470) at paccheck.c:387
#3 0x00404c97 in main (argc=2, argv=0xbffff0d4) at paccheck.c:835
(gdb) up
#1 0xb7d197ac in strncpy () from /usr/lib/libc.so.6
(gdb) up
#2 0x0040332b in check_files (pkg=0x427470) at paccheck.c:387
387 strncpy(rel, file.name, space);
(gdb) print rel
$1 = 0xbfffdf8d "etc"
(gdb) print file.name
$2 = 0x0
(gdb) print space
$3 = 4095
(gdb) print file
$4 = {name = 0x0, size = 4973296, mode = 0}
Rebuilding like this fixes the issue:
make CFLAGS='-D_FILE_OFFSET_BITS=64' PREFIX=/
Presumably -D_FILE_OFFSET_BITS=64
needs to be set on 32-bit platforms. Maybe it is a mismatch in build flags between libalpm and pacutils?
Downstream Arch32 bug: https://bugs.archlinux32.org/index.php?do=details&task_id=317
There does seem to be additional issues on 32-bit, I cannot get the unit tests to pass. But that should probably be a separate bug.