Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 May 2018 16:18:07 +0000
From:      bugzilla-noreply@freebsd.org
To:        pkg@FreeBSD.org
Subject:   maintainer-feedback requested: [Bug 228073] ports-mgmt/pkg: pkg install fails with a segfault
Message-ID:  <bug-228073-32340-Mcon0zmDdZ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-228073-32340@https.bugs.freebsd.org/bugzilla/>
References:  <bug-228073-32340@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-pkg mailing li=
st
<pkg@FreeBSD.org> for maintainer-feedback:
Bug 228073: ports-mgmt/pkg: pkg install fails with a segfault
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D228073



--- Description ---
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-cli=
ent
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, sinc=
e 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 a=
nd
poudriere is significant.  In my case, I had
[port]net/openldap24-sasl-client[/port] installed and locked.  Unlocking th=
at
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 fil=
e or
directory'
    fstat(5,{ mode=3D-rw-r--r-- ,inode=3D882832,size=3D3682304,blksize=3D32=
768 }) =3D 0
(0x0)
    pread(0x5,0x7fffffffdad0,0x10,0x18) 	     =3D 16 (0x10)
    fstat(5,{ mode=3D-rw-r--r-- ,inode=3D882832,size=3D3682304,blksize=3D32=
768 }) =3D 0
(0x0)
    fstatat(4,"local.sqlite-wal",0x7fffffffda20,0x0) ERR#2 'No such file or
directory'
    fstat(5,{ mode=3D-rw-r--r-- ,inode=3D882832,size=3D3682304,blksize=3D32=
768 }) =3D 0
(0x0)
    fcntl(5,F_SETLK,0x7fffffffda50)		     =3D 0 (0x0)
    fcntl(5,F_SETLK,0x7fffffffda58)		     =3D 0 (0x0)
    fcntl(5,F_SETLK,0x7fffffffda58)		     =3D 0 (0x0)
    fcntl(5,F_SETLK,0x7fffffffda58)		     =3D 0 (0x0)
    fstatat(4,"local.sqlite-journal",0x7fffffffda20,0x0) ERR#2 'No such fil=
e or
directory'
    fstat(5,{ mode=3D-rw-r--r-- ,inode=3D882832,size=3D3682304,blksize=3D32=
768 }) =3D 0
(0x0)
    pread(0x5,0x7fffffffdad0,0x10,0x18) 	     =3D 16 (0x10)
    fstat(5,{ mode=3D-rw-r--r-- ,inode=3D882832,size=3D3682304,blksize=3D32=
768 }) =3D 0
(0x0)
    fstatat(4,"local.sqlite-wal",0x7fffffffda20,0x0) ERR#2 'No such file or
directory'
    fstat(5,{ mode=3D-rw-r--r-- ,inode=3D882832,size=3D3682304,blksize=3D32=
768 }) =3D 0
(0x0)
    pread(0x5,0x803364c58,0x1000,0x5b000)	     =3D 4096 (0x1000)
    pread(0x5,0x803363b48,0x1000,0x15000)	     =3D 4096 (0x1000)
    pread(0x5,0x803362a38,0x1000,0x33e000)	     =3D 4096 (0x1000)
    fcntl(5,F_SETLK,0x7fffffffde20)		     =3D 0 (0x0)
    getpid()					     =3D 18596 (0x48a4)
    DBG(1)[18596]> cannot load files from openldap-client and (null) to che=
ck
conflicts
    write(2,"DBG(1)[18596]> cannot load files"...,84) =3D 84 (0x54)
    SIGNAL 11 (SIGSEGV)
    process killed, signal =3D 11 (core dumped)

There's nothing helpful in the core dump:

    # lldb /usr/sbin/pkg=20=20=20=20=20=20
    (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 =3D 'pkg', stop reason =3D signal SIGSEGV
      * frame #0: 0x0000000800a3f393
	frame #1: 0x0000000803254a80
    (lldb)=20


(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=3D128154.0
[4] https://forums.freebsd.org/threads/pkg-core-dump.56957/
[5]
https://forums.freebsd.org/threads/pkg-upgrade-v-segfaults-wrong-option.647=
68/#
post-378491



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-228073-32340-Mcon0zmDdZ>