Hi, if you populate /usr/ports but remove INDEX-* files from it (or checkout it from svn, then INDEX-* files are not there), then 'pkg version -x not-existing-package' crashes: Child process pid=5172 terminated abnormally: Segmentation fault This only happens when /usr/ports is populated but /usr/ports/INDEX-* files are NOT present. BR, Marko
Thank you for your report What version of FreeBSD? Please include `uname -a` output What version of pkg is running? Please include pkg -vvv output as an attachment Did this work prior to a particular version, or before the version you are using? Additionally, if you could provide a debugging backtrace of the pkg{-static}.core file using gdb (bt command), that might assist isolating the issue.
Hi, it's easy to reproduce, I reproduced this on both: FreeBSD shkatula 10.3-BETA3 FreeBSD 10.3-BETA3 #0 r296341: Thu Mar 3 10:54:35 CET 2016 root@shkatula:/usr/obj/usr/src/sys/GENERIC amd64 FreeBSD fte 10.2-RELEASE-p5 FreeBSD 10.2-RELEASE-p5 #0: Thu Sep 24 01:06:05 CEST 2015 root@fte:/usr/obj/usr/src/sys/GENERIC i386 I'm not sure when it started failing, I just noticed it now. I'll attach pkg -vvv. GDB backtrace: Core was generated by `pkg'. Program terminated with signal 11, Segmentation fault. #0 0x000000000041aa79 in ?? () (gdb) bt #0 0x000000000041aa79 in ?? () #1 0x0000000000000000 in ?? () (gdb) BR, Marko
Created attachment 167705 [details] pkg -vvv output
Could you try rebuilding pkg WITH_DEBUG=yes (adds -g to CFLAGS and prevents stripping), and try the backtrace again (as attachment) Thanks!
After WITH_DEBUG=yes pkg binary is still stripped, I must've done something wrong. But I managed to get usable core dump with pkg-static: Core was generated by `pkg-static'. Program terminated with signal 11, Segmentation fault. #0 0x0806abe6 in free_categories () at version.c:359 359 kh_foreach_value(categories, cat, { (gdb) bt #0 0x0806abe6 in free_categories () at version.c:359 #1 0x0806a74e in do_source_ports (opt=1024, limchar=45 '-', pattern=0xbfbfee32 "aaaaaaa", match=MATCH_REGEX, matchorigin=0x0, matchname=0x0, portsdir=0x28c04160 "/usr/ports") at version.c:781 #2 0x08069698 in exec_version (argc=0, argv=0xbfbfed00) at version.c:997 #3 0x0805926e in main (argc=3, argv=0xbfbfecf4) at main.c:852 BR, Marko
The problem is probably in version.c:359: if (categories == NULL) return; should be added.
Fixed in master will be in 1.6.5 thanks!