[Bug 228073] ports-mgmt/pkg: pkg install fails with a segfault

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue May 8 16:18:10 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228073

            Bug ID: 228073
           Summary: ports-mgmt/pkg: pkg install fails with a segfault
           Product: Ports & Packages
           Version: Latest
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: pkg at FreeBSD.org
          Reporter: gray at nxg.name
             Flags: maintainer-feedback?(pkg at FreeBSD.org)
          Assignee: pkg at FreeBSD.org

Summary: pkg install fails with a segfault.

Overview:

Running [cmd]pkg -d install nss_ldap[/cmd], I get

    [...snip...]
    DBG(1)[18232]> Binary> loading
/var/cache/pkg/nss_ldap-1.265_12-d66117adb0.txz
    DBG(1)[18232]> Binary> loading
/var/cache/pkg/openldap-client-2.4.46-98cfbc28cf.txz
    Checking integrity...DBG(1)[18232]> cannot load files from openldap-client
and (null) to check conflicts
    zsh: segmentation fault (core dumped)  pkg -d install nss_ldap

Steps to reproduce:

  * Install and lock openldap-sasl-client
  * Install nss_ldap

(...probably -- I think this is likely to produce the above behaviour, since I
now suspect that it's the locked package that is the root cause, but see
the additional information below).

Actual results:

Segfault

Expected results:

Not segfault.  If there is a problem, pkg should diagnose and report the
problem.

Version information:

This is pkg 1.10.5, on 11.1-RELEASE-p9.

Additional information:

This appears to be related to the issues in [1-5] (the first three are from
2017 or 2018), but not exactly the same as any.

This is presumably very closely related to bug #228039, but I'm creating it as
a separate bug on the off-chance that that bug's relationship to dovecote and
poudriere is significant.  In my case, I had
[port]net/openldap24-sasl-client[/port] installed and locked.  Unlocking that
allowed [cmd]pkg install nss_ldap[/cmd] to work, but replaced
openldap-sasl-client with openldap-client and then reinstalled
openldap-sasl-client, which conflicts (so there are perhaps other problems
here).  Note that the messages below refer to openldap-client (which wasn't
initially installed), not openldap-sasl-client (which was).

This _might_ be related also to bug #218594, but that bug report refsrs to `pkg
upgrade`, and notes/speculates that it is related to perl being locked.

And running [cmd]truss pkg -d install nss_ldap[/cmd], I get

    fstatat(4,"local.sqlite-journal",0x7fffffffda20,0x0) ERR#2 'No such file or
directory'
    fstat(5,{ mode=-rw-r--r-- ,inode=882832,size=3682304,blksize=32768 }) = 0
(0x0)
    pread(0x5,0x7fffffffdad0,0x10,0x18)              = 16 (0x10)
    fstat(5,{ mode=-rw-r--r-- ,inode=882832,size=3682304,blksize=32768 }) = 0
(0x0)
    fstatat(4,"local.sqlite-wal",0x7fffffffda20,0x0) ERR#2 'No such file or
directory'
    fstat(5,{ mode=-rw-r--r-- ,inode=882832,size=3682304,blksize=32768 }) = 0
(0x0)
    fcntl(5,F_SETLK,0x7fffffffda50)                  = 0 (0x0)
    fcntl(5,F_SETLK,0x7fffffffda58)                  = 0 (0x0)
    fcntl(5,F_SETLK,0x7fffffffda58)                  = 0 (0x0)
    fcntl(5,F_SETLK,0x7fffffffda58)                  = 0 (0x0)
    fstatat(4,"local.sqlite-journal",0x7fffffffda20,0x0) ERR#2 'No such file or
directory'
    fstat(5,{ mode=-rw-r--r-- ,inode=882832,size=3682304,blksize=32768 }) = 0
(0x0)
    pread(0x5,0x7fffffffdad0,0x10,0x18)              = 16 (0x10)
    fstat(5,{ mode=-rw-r--r-- ,inode=882832,size=3682304,blksize=32768 }) = 0
(0x0)
    fstatat(4,"local.sqlite-wal",0x7fffffffda20,0x0) ERR#2 'No such file or
directory'
    fstat(5,{ mode=-rw-r--r-- ,inode=882832,size=3682304,blksize=32768 }) = 0
(0x0)
    pread(0x5,0x803364c58,0x1000,0x5b000)            = 4096 (0x1000)
    pread(0x5,0x803363b48,0x1000,0x15000)            = 4096 (0x1000)
    pread(0x5,0x803362a38,0x1000,0x33e000)           = 4096 (0x1000)
    fcntl(5,F_SETLK,0x7fffffffde20)                  = 0 (0x0)
    getpid()                                         = 18596 (0x48a4)
    DBG(1)[18596]> cannot load files from openldap-client and (null) to check
conflicts
    write(2,"DBG(1)[18596]> cannot load files"...,84) = 84 (0x54)
    SIGNAL 11 (SIGSEGV)
    process killed, signal = 11 (core dumped)

There's nothing helpful in the core dump:

    # lldb /usr/sbin/pkg      
    (lldb) target create "/usr/sbin/pkg"
    Current executable set to '/usr/sbin/pkg' (x86_64).
    (lldb) target create --core /root/pkg.core
    Core file '/root/pkg.core' (x86_64) was loaded.
    (lldb) th b
    * thread #1, name = 'pkg', stop reason = signal SIGSEGV
      * frame #0: 0x0000000800a3f393
        frame #1: 0x0000000803254a80
    (lldb) 


(I tried to build [port]ports-mgmt/pkg[/port] from [file]/usr/ports[/file], but
that installed 1.10.1, which then insisted on installing 1.10.5)

The [icode](null)[/icode] in the [cmd]pkg -d[/cmd] output seems broadly
consistent with the discussion in [3], but there isn't an obviously related
'file not found' in the truss output.

Removing `/var/cacke/pkg/nss_ldap*` doesn't have any effect.

Looking at the pkg-1.10.5 source, it would appear that something is amiss in
[icode]libpkg/pkg_jobs_conflicts.c:pkg_conflicts_need_conflict[/icode], but
it's not obvious to me what it is, nor whether there's a file I can either
delete or dummy.




[1] https://github.com/freebsd/pkg/issues/1663
[2] https://github.com/freebsd/pkg/pull/1586
[3] https://forum.pfsense.org/index.php?topic=128154.0
[4] https://forums.freebsd.org/threads/pkg-core-dump.56957/
[5]
https://forums.freebsd.org/threads/pkg-upgrade-v-segfaults-wrong-option.64768/#post-378491

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list