Gentoo Archives: gentoo-portage-dev

From: Alec Warner <antarus@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Sam James <sam@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH 1/2] doebuild.py: check for inconsistent PROVIDES/image post-src_install
Date: Mon, 04 Oct 2021 19:35:14
Message-Id: CAAr7Pr8vSw--soKvFANecGHtgEMxOz+5=6jTyouY7Hy0nRztOQ@mail.gmail.com
In Reply to: [gentoo-portage-dev] [PATCH 1/2] doebuild.py: check for inconsistent PROVIDES/image post-src_install by Sam James
1 On Sat, Oct 2, 2021 at 1:11 PM Sam James <sam@g.o> wrote:
2 >
3 > This is part of a series of fixes for the linked bug (failure
4 > to preserve libraries in some situations).
5 >
6 > At the point of installation (even if not merging), we need
7 > to detect inconsistent metadata: PROVIDES should be populated
8 > if we're installing any dynamic libraries. This suggests that
9 > e.g. scanelf malfunctioned or some corruption occurred.
10 >
11 > Bug: https://bugs.gentoo.org/811462
12 > Signed-off-by: Sam James <sam@g.o>
13 > ---
14 > lib/portage/package/ebuild/doebuild.py | 24 +++++++++++++++++++++++-
15 > 1 file changed, 23 insertions(+), 1 deletion(-)
16 >
17 > diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
18 > index 9650a8444..dc3fe3d97 100644
19 > --- a/lib/portage/package/ebuild/doebuild.py
20 > +++ b/lib/portage/package/ebuild/doebuild.py
21 > @@ -3,6 +3,7 @@
22 >
23 > __all__ = ["doebuild", "doebuild_environment", "spawn", "spawnebuild"]
24 >
25 > +import glob
26 > import grp
27 > import gzip
28 > import errno
29 > @@ -3079,7 +3080,7 @@ def _post_src_install_soname_symlinks(mysettings, out):
30 > ) as f:
31 > f.write(soname_deps.requires)
32 >
33 > - if soname_deps.provides is not None:
34 > + if soname_deps.provides:
35
36 The previous code checked if soname_deps.provides was None (or not.)
37 You have changed it to check if soname_deps.provides is true-ish (or not.)
38
39 Why did you change it?
40
41 > with io.open(
42 > _unicode_encode(
43 > os.path.join(build_info_dir, "PROVIDES"),
44 > @@ -3091,6 +3092,27 @@ def _post_src_install_soname_symlinks(mysettings, out):
45 > errors="strict",
46 > ) as f:
47 > f.write(soname_deps.provides)
48 > + else:
49 > + # Let's check if we've got inconsistent results.
50 > + # If we're installing dynamic libraries (.so files), we should
51 > + # really have a PROVIDES.
52 > + # (This is a complementary check at the point of creation for the
53 > + # ingestion check in Binpkg.py)
54 > + # Note: we could check a non-empty PROVIDES against the list of .sos,
55 > + # but this doesn't gain us anything. We're interested in failure
56 > + # to properly parse the installed files at all, which should really
57 > + # be a global problem (e.g. bug #811462)
58 > + installed_dynlibs = glob.glob(image_dir + "/**/*.so", recursive=True)
59 > +
60 > + if installed_dynlibs:
61 > + self._writemsg_level(
62 > + colorize(
63 > + "BAD",
64 > + "!!! Error! Installing dynamic libraries (.so) with blank PROVIDES!",
65 > + ),
66 > + noiselevel=-1,
67 > + level=logging.ERROR,
68 > + )
69 >
70 > if unrecognized_elf_files:
71 > qa_msg = ["QA Notice: Unrecognized ELF file(s):"]
72 > --
73 > 2.33.0
74 >
75 >