Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Nov 2021 14:56:54 +0100
From:      Stefan Esser <se@freebsd.org>
To:        Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        freebsd-pkg@FreeBSD.org
Subject:   BACKUP_LIBRARIES issue
Message-ID:  <4119af9a-f330-ca89-dc61-c28b7abcc247@freebsd.org>
In-Reply-To: <624a7435-eaf3-03db-c47c-29783f45ede9@freebsd.org>
References:  <15967907-03dc-a2ab-df86-6097d8d808f6@ohreally.nl> <20211108075438.jtqkak6n22n5rlg7@aniel.nours.eu> <9df3553b-b2c3-6b35-f06c-f123b981a613@ohreally.nl> <20211108095919.wfqj3kr2m6du5xsr@aniel.nours.eu> <9ea022cc-0886-6bfe-4f5c-993b2a683e3e@ohreally.nl> <4d28dae0-043f-dffd-ce79-644ee6e226e0@freebsd.org> <668211f6-e7db-8875-1c1e-214ed2d4388c@ohreally.nl> <20211108150652.5ckawymyfxdls4ys@aniel.nours.eu> <624a7435-eaf3-03db-c47c-29783f45ede9@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------ysqe4KvPVnfevYalNO3020qG
Content-Type: multipart/mixed; boundary="------------3cyLmxNXlPnnSfZEEbX9H2bH";
 protected-headers="v1"
From: Stefan Esser <se@freebsd.org>
To: Baptiste Daroussin <bapt@FreeBSD.org>
Cc: freebsd-pkg@FreeBSD.org
Message-ID: <4119af9a-f330-ca89-dc61-c28b7abcc247@freebsd.org>
Subject: BACKUP_LIBRARIES issue
References: <15967907-03dc-a2ab-df86-6097d8d808f6@ohreally.nl>
 <20211108075438.jtqkak6n22n5rlg7@aniel.nours.eu>
 <9df3553b-b2c3-6b35-f06c-f123b981a613@ohreally.nl>
 <20211108095919.wfqj3kr2m6du5xsr@aniel.nours.eu>
 <9ea022cc-0886-6bfe-4f5c-993b2a683e3e@ohreally.nl>
 <4d28dae0-043f-dffd-ce79-644ee6e226e0@freebsd.org>
 <668211f6-e7db-8875-1c1e-214ed2d4388c@ohreally.nl>
 <20211108150652.5ckawymyfxdls4ys@aniel.nours.eu>
 <624a7435-eaf3-03db-c47c-29783f45ede9@freebsd.org>
In-Reply-To: <624a7435-eaf3-03db-c47c-29783f45ede9@freebsd.org>

--------------3cyLmxNXlPnnSfZEEbX9H2bH
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Following up on my previous mail, since libraries saved to compat/pkg jus=
t
broke Samba on my system after an upgrade:

$ ldconfig -r
search directories:
/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat/pkg:/u=
sr/local/lib/compat:/usr/local/lib/dovecot:/usr/local/lib/expect5.45.4:/u=
sr/local/lib/gcc10:/usr/local/lib/gcc9:/usr/local/lib/graphviz:/usr/local=
/lib/mysql:/usr/local/lib/mysql/plugin:/usr/local/lib/perl5/5.32/mach/COR=
E:/usr/local/lib/pth:/usr/local/lib/qt5:/usr/local/lib/samba4:/usr/local/=
lib/signon:/usr/local/lib/signon/extensions:/usr/local/lib/wine:/usr/loca=
l/llvm10/lib:/usr/local/llvm11/lib:/usr/local/llvm12/lib:/usr/local/llvm1=
3/lib:/usr/local/llvm70/lib:/usr/local/llvm80/lib:/usr/local/llvm90/lib:/=
usr/local/share/chromium:/usr/local/share/code-oss:/usr/local/share/elect=
ron12

Since /usr/local/lib/compat/pkg is the 5th element in the search path,
/usr/local/lib/samba4 the 17th, the same-name libraries in the compat/pkg=

directory take precedence over the newly installed libraries in the
samba4 directory.

Since paths are added to the search list at the end, when new packages
are installed, lib/compat/pkg may end up in the middle of the search
path, even when it was at the end at boot time.

I see 2 possible solutions:

1) Make sure that compat library paths come last (e.g. by adding a new
   option letter to specify compat library paths: ldconfig -b compat/pkg)=
=2E
   Or special-case compat paths in ldconfig to implicitly add them only a=
t
   the end of a search path (without requiring a new option letter).

2) Make the pkg command remove libraries from the compat/pkg directory
   if a same-name library is installed in some other system directory.

Without such a safe-guard, software that installs libraries with internal=

interface version numbers/checks under the same name as previous incompat=
ible
versions (e.g. samba, dovecot, ...) will fail to start.

Am 08.11.21 um 17:28 schrieb Stefan Esser:
> Am 08.11.21 um 16:06 schrieb Baptiste Daroussin:
>> On Mon, Nov 08, 2021 at 04:03:56PM +0100, freebsd@ohreally.nl wrote:
>>> Thank you, Stefan.
>>> I am creating an issue at the portupgrade/pkgtools GitHub project as =
we
>>> speak. I will include all the information that Baptiste and you have =
given
>>> me.
>>>
>>> Best,
>>>   Rob
>>>
>>
>> Just the "No such file or directory @ rb_check_realpath_internal" show=
s it comes
>> from portupgrade and not pkg itself, I missed it in my first review.
>>
>> Note that portmaster and portupgrade do not need to support that featu=
re anymore
>> as it is provided by pkg directly (they just need to activate it or no=
t if they
>> wants for backward compatibility).
> Hi Baptiste,
>=20
> thank you for the information, I did not know about BACKUP_LIBRARIES.
>=20
> But I think that the functionality is somewhat different. Portmaster
> creates a copy of a local library before invoking "pkg delete" to keep
> it around for any ports that still depend on it.
>=20
> If a port is being upgraded and a library with the same name is
> installed to /usr/local/lib, the backup in compat/pkg will be deleted.
>=20
> AFAIUI, the effect of BACKUP_LIBRARIES, it has no effect on any command=

> besides "pkg add", and it specifically does not protect against the rem=
oval
> of a shared library that is still required by some installed package.
> It does not appear to have any effect if "make install" is used to inst=
all
> a port (since that only uses "pkg register", not "pkg add".)
>=20
> The pkg command could check whether any of the libraries to be deleted
> by "pkg delete" is still depended on by any other package (i.e. in the
> list generated by "pkg query %B") and then copy it to compat/pkg, if
> still being depended on.
>=20
> OTOH if a new package is installed, any library in compat/pkg that is
> in the list of newly installed libraries can be removed from compat/pkg=
=2E
>=20
> This is important, since I found that "ldconfig -m" tends to add newly
> created shared library locations to the end of the search path, and as
> a result if a shared library has been saved to compat/pkg, it will take=

> precedence over a newly installed one. Therefore, removal of libraries
> from compat/pkg is required in that case, to make the newly installed
> libraries accessible.
>=20
> Regards, STefan
>=20
> PS: The documentation of BACKUP_LIBRARIES in pkg.conf(5) is not
> very precise. And this parameter could be added to the list of
> environment variables checked by "pkg add" in pkg-add(8).
>=20

--------------3cyLmxNXlPnnSfZEEbX9H2bH--

--------------ysqe4KvPVnfevYalNO3020qG
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmGPxCYFAwAAAAAACgkQR+u171r99US6
kwgArLjJLJKCmCQzb+bPFkBurYUL1iFSLktPOMWREdcqDEg5OaDujDCWHrLiIFGTXo6ztBdYUOdg
5CPv5eVxRUz8od1wMMB/DVJjCbzYCdW0vAs3830fpZn4SZGjw5RT5bX9oMMQUVnvCBon1dnhLwv6
NvQe6zuUrezffyf2IbpwfTK+SvaSPTA0pMs5IFMrPSK/RQTvS/XZxkxEijbgPKzE/KCe/Rmwu1fX
Y1PqftQ7oVlvNOMlnOsflqFX5WDdjOKRwho3R6FiqaxPR8sBEumiGlpV9MUDDw7AC7OA/B4vBfnt
AKVWI53gVvrtbhvIDNGmR2lILRbKpC+j9Uaz4MjUyQ==
=DDQJ
-----END PGP SIGNATURE-----

--------------ysqe4KvPVnfevYalNO3020qG--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4119af9a-f330-ca89-dc61-c28b7abcc247>