[Bug 265061] ports-mgmt/pkg pkgbase wrong depends, lib32 instead of libs for many packages

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 29 Oct 2024 08:15:39 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265061

keve@keve.hu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keve@keve.hu

--- Comment #8 from keve@keve.hu ---
IMO this is a problem with how pkgbase is creating packages and not an issue
with pkg.
As an example, here are the manifests for FreeBSD-libbsm(-lib32).
FreeBSD-libbsm:

name: "FreeBSD-libbsm"
origin: "base"
version: "14.1"
comment: "libbsm package"
maintainer: "re@FreeBSD.org"
www: "https://www.FreeBSD.org"
abi: "FreeBSD:14:amd64"
arch: "freebsd:14:"
prefix: "/"
flatsize: 108888
timestamp: 1730187871
licenselogic: "single"
licenses: [
    "BSD2CLAUSE"
]
desc: "libbsm package"
categories: [
    "base"
]
shlibs_required: [
    "libc.so.7"
]
shlibs_provided: [
    "libbsm.so.3"
]
annotations: {
    FreeBSD_version: "1401000",
    repo_type: "binary",
    repository: "local-base"
}
files: {
    /usr/lib/libbsm.so.3:
"1$a8b14ac2b9a568a5f0cbb3b46031d2fbef4f806b2739dcc70efbbd2dde491cef"
}


FreeBSD-libbsm-lib32:

name: "FreeBSD-libbsm-lib32"
origin: "base"
version: "14.1"
comment: "libbsm package (32-bit Libraries)"
maintainer: "re@FreeBSD.org"
www: "https://www.FreeBSD.org"
abi: "FreeBSD:14:amd64"
arch: "freebsd:14:"
prefix: "/"
flatsize: 98312
timestamp: 1730187873
licenselogic: "single"
licenses: [
    "BSD2CLAUSE"
]
desc: "libbsm package"
categories: [
    "base"
]
shlibs_required: [
    "libc.so.7"
]
shlibs_provided: [
    "libbsm.so.3"
]
annotations: {
    FreeBSD_version: "1401000",
    repo_type: "binary",
    repository: "local-base"
}
files: {
    /usr/lib32/libbsm.so.3:
"1$6e4e94c6467156a0b84b1b7800b6b58e8734ca4aa9ced977f2007fdff200c194"
}

From the perspective of pkg, both packages are for the same ABI, same version
and both provide libbsm.so.3 (note that shlibs_required/_provided does not have
path information). Thus when looking for packages providing libbsm.so.3 these
two alternatives are alike from pkg's perspective and any of them is a valid
pick.

freebsd-pkg does not embed hard depencendies between packages for shared
libraries, but relies on pkg to resolve them with shlibs_required.

Because of the ambiguity of the proper/lib32 version, it is pure luck which one
is picked by pkg for installation, and the whole concept of not needing to care
for dependent packages is voided. A reliable installation can only be ensured
if one manually adds all the library packages.

The issue can should be solved by providing more information to pkg, i.e. by
changing pkgbase to write a different manifest.

Alternatives
1/ Make X-lib32 depend on X. This fixes the the most common case, dependency on
libX is ensured via a side-effect, but does not fix the libX32 case, for a
lib32-package, a non lib32 package could be picked providing the library.

2/ Use hard dependencies in X-lib32 packages, and do not rely on pkg to collect
shared lib depencencies. This solves all cases.

3/ Use hard dependencies in all packages and do not use
shlibs_required/_provided functionality at all.


As long as there is no way to signal "lib32", e.g. with a different ABI string
to pkg, there is no way for pkg to distinguish these packages and pick the
right one.

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