pkg icon indicating copy to clipboard operation
pkg copied to clipboard

segfault in pkg-devel (1.19.99.1)

Open kevans91 opened this issue 2 years ago • 4 comments

Attempting to do a pkg upgrade -yr FreeBSD, I'm hitting a segfault here: https://github.com/freebsd/pkg/blob/master/libpkg/pkg_jobs.c#L2181

j->patterns is NULL in this contexct. It does hit some conflicts in the beginning:

FreeBSD repository is up to date.                                                                             
All repositories are up to date.                                                                              
Checking for upgrades (319 candidates): 100%                                                                  
Processing candidates (319 candidates):   0%                                                                  
pkg: graphene has a missing dependency: py38-gobject3                                                         
Processing candidates (319 candidates): 100%                                                                  
Checking integrity... done (8 conflicting)                                                                    
  - pkg-1.19.1 [FreeBSD] conflicts with pkg-devel-1.19.99.1 [installed] on /usr/local/etc/bash_completion.d/_pkg.bash
  - pkg-1.19.1 [FreeBSD] conflicts with pkg-devel-1.19.99.1 [FreeBSD] on /usr/local/etc/bash_completion.d/_pkg.bash
  - autoconf2.69-2.69 [FreeBSD] conflicts with autoconf-2.69_4 [installed] on /usr/local/bin/autoconf2.69     
  - cmake-man-3.25.1 [FreeBSD] conflicts with cmake-3.23.0 [installed] on /usr/local/man/man1/ccmake.1.gz     
  - cmake-core-3.25.1 [FreeBSD] conflicts with cmake-3.23.0 [installed] on /usr/local/bin/ccmake              
  - boehm-gc-threaded-8.2.2 [FreeBSD] conflicts with boehm-gc-8.0.6 [installed] on /usr/local/include/gc/gc_pthread_redirects.h
  - e2fsprogs-core-1.46.6 [FreeBSD] conflicts with e2fsprogs-1.46.5 [installed] on /usr/local/bin/chattr       
  - libaec-1.0.6 [FreeBSD] conflicts with hdf-szip-2.1.1 [installed] on /usr/local/include/szlib.h            
Cannot solve problem using SAT solver, trying another plan                                                    
Checking integrity... done (0 conflicting)                                                                    
The following 333 package(s) will be affected (of 0 checked):                                                  
                                                                                                             

I can leave the system in this state for a while if I need to provide any more information. It's segfaulted just after agreeing to the plan it did eventually come up with.

Number of packages to be removed: 2
Number of packages to be installed: 20
Number of packages to be upgraded: 293
Number of packages to be reinstalled: 18

The process will require 538 MiB more space.

Thread 2.1 received signal SIGSEGV, Segmentation fault.

Just to throw this out:

(gdb) print *ps
$2 = {items = {0x801509c20, 0x0}, xlink = 0x0, type = PKG_SOLVED_DELETE}
(gdb) print *p
$3 = {direct = false, locked = false, automatic = false, vital = false, id = 41859, scripts = {0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, lua_scripts = {{head = 0x0, tail = 0x0, length = 0}, {head = 0x0, 
      tail = 0x0, length = 0}, {head = 0x0, tail = 0x0, length = 0}, {head = 0x0, tail = 0x0, length = 0}, {
      head = 0x0, tail = 0x0, length = 0}}, name = 0x801429260 "pkg-devel", 
  origin = 0x801509d80 "ports-mgmt/pkg-devel", version = 0x8014292d0 "1.19.99.1", old_version = 0x0, 
  maintainer = 0x8014292e0 "[email protected]", www = 0x801509cc0 "https://github.com/freebsd/pkg", 
  arch = 0x801509c60 "freebsd:14:x86:64", abi = 0x801509d60 "FreeBSD:14:amd64", 
  uid = 0x8014292f0 "pkg-devel", 
  digest = 0x801445aa0 "2$2$qec3rpsbkbsm4qcgjj94798hqyejihomgjdyhghr33kbh6kitekatcthp9kxbnz87rbqwses3ht8nf8izokm1imjeczxqrc4tgbkcey", old_digest = 0x0, message = {head = 0x0, tail = 0x0, length = 0}, 
  prefix = 0x8014292a0 "/usr/local", comment = 0x8014292b0 "Package manager", 
  desc = 0x801546c80 "Package management tool\n\nWWW: https://github.com/freebsd/pkg", sum = 0x0, 
  repopath = 0x0, reponame = 0x0, repourl = 0x0, reason = 0x0, dep_formula = 0x0, 
  licenselogic = LICENSE_SINGLE, pkgsize = 0, flatsize = 48857325, old_flatsize = 0, timestamp = 1675912211, 
  depshash = 0x0, depends = 0x0, rdepshash = 0x0, rdepends = 0x0, categories = {head = 0x0, tail = 0x0, 
    length = 0}, licenses = {head = 0x0, tail = 0x0, length = 0}, filehash = 0x81826a7e0, 
  files = 0x842879c00, dirhash = 0x81826a9a0, dirs = 0x8418b4d00, optionshash = 0x801509c40, 
  options = 0x8015116e0, users = {head = 0x0, tail = 0x0, length = 0}, groups = {head = 0x0, tail = 0x0, 
    length = 0}, shlibs_required = {head = 0x0, tail = 0x0, length = 0}, shlibs_provided = {
    head = 0x801509d40, tail = 0x801509d40, length = 1}, conflictshash = 0x81826aa00, 
  conflicts = 0x8195b50a0, provides = {head = 0x0, tail = 0x0, length = 0}, requires = {head = 0x0, 
    tail = 0x0, length = 0}, config_files_hash = 0x0, config_files = 0x0, annotations = {head = 0x801509d00, 
    tail = 0x801509dc0, length = 3}, flags = 64567, rootfd = -1, rootpath = '\000' <repeats 1023 times>, 
  dir_to_del = {head = 0x0, tail = 0x0, length = 0}, type = PKG_INSTALLED, repo = 0x0}
(gdb) print *j
$4 = {universe = 0x801510cf0, request_add = 0x80157ac00, request_delete = 0x0, jobs = {head = 0x8190d5500, 
    tail = 0x8190d7200, length = 337}, db = 0x801426db0, type = PKG_JOBS_UPGRADE, 
  flags = PKG_FLAG_PKG_VERSION_TEST, solved = 2, count = 337, total = 0, conflicts_registered = 0, 
  need_fetch = false, reponame = 0x7fffffffed32 "FreeBSD", destdir = 0x0, conflict_items = 0x80eb600e0, 
  patterns = 0x0, conservative = true, pinning = true, lockedpkgs = 0x0, triggers = {schema = 0x0, dfd = -1, 
    cleanup = 0x0, post_transaction = 0x0, post_install = 0x0}}

kevans91 avatar Feb 09 '23 04:02 kevans91

it is interesting that you end up with a conflict between the local pkg and the remote one and it seems pkg does not seems to understand it is the same package.

bapt avatar Feb 09 '23 07:02 bapt

There is a WITH_PKG=devel somewhere in there and not in the other part I think

evadot avatar Feb 09 '23 08:02 evadot

I do think so, still this should not crash :D

bapt avatar Feb 09 '23 08:02 bapt

Agreed :)

evadot avatar Feb 09 '23 08:02 evadot

overcome by events (I think )

bapt avatar Jul 01 '24 14:07 bapt