public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Sam James <sam@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH 1/2] doebuild.py: check for inconsistent PROVIDES/image post-src_install
Date: Sat,  2 Oct 2021 21:11:24 +0100	[thread overview]
Message-ID: <20211002201125.346005-2-sam@gentoo.org> (raw)
In-Reply-To: <20211002201125.346005-1-sam@gentoo.org>

This is part of a series of fixes for the linked bug (failure
to preserve libraries in some situations).

At the point of installation (even if not merging), we need
to detect inconsistent metadata: PROVIDES should be populated
if we're installing any dynamic libraries. This suggests that
e.g. scanelf malfunctioned or some corruption occurred.

Bug: https://bugs.gentoo.org/811462
Signed-off-by: Sam James <sam@gentoo.org>
---
 lib/portage/package/ebuild/doebuild.py | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index 9650a8444..dc3fe3d97 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -3,6 +3,7 @@
 
 __all__ = ["doebuild", "doebuild_environment", "spawn", "spawnebuild"]
 
+import glob
 import grp
 import gzip
 import errno
@@ -3079,7 +3080,7 @@ def _post_src_install_soname_symlinks(mysettings, out):
         ) as f:
             f.write(soname_deps.requires)
 
-    if soname_deps.provides is not None:
+    if soname_deps.provides:
         with io.open(
             _unicode_encode(
                 os.path.join(build_info_dir, "PROVIDES"),
@@ -3091,6 +3092,27 @@ def _post_src_install_soname_symlinks(mysettings, out):
             errors="strict",
         ) as f:
             f.write(soname_deps.provides)
+    else:
+        # Let's check if we've got inconsistent results.
+        # If we're installing dynamic libraries (.so files), we should
+        # really have a PROVIDES.
+        # (This is a complementary check at the point of creation for the
+        # ingestion check in Binpkg.py)
+        # Note: we could check a non-empty PROVIDES against the list of .sos,
+        # but this doesn't gain us anything. We're interested in failure
+        # to properly parse the installed files at all, which should really
+        # be a global problem (e.g. bug #811462)
+        installed_dynlibs = glob.glob(image_dir + "/**/*.so", recursive=True)
+
+        if installed_dynlibs:
+            self._writemsg_level(
+                colorize(
+                    "BAD",
+                    "!!! Error! Installing dynamic libraries (.so) with blank PROVIDES!",
+                ),
+                noiselevel=-1,
+                level=logging.ERROR,
+            )
 
     if unrecognized_elf_files:
         qa_msg = ["QA Notice: Unrecognized ELF file(s):"]
-- 
2.33.0



  reply	other threads:[~2021-10-02 20:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02 20:11 [gentoo-portage-dev] [PATCH 0/2] Detect broken VDB on merging/binpkg creation Sam James
2021-10-02 20:11 ` Sam James [this message]
2021-10-04 19:35   ` [gentoo-portage-dev] [PATCH 1/2] doebuild.py: check for inconsistent PROVIDES/image post-src_install Alec Warner
2021-10-02 20:11 ` [gentoo-portage-dev] [PATCH 2/2] Binpkg.py: check for inconsistent PROVIDES/image when unpacking binpkg Sam James
2021-10-04 19:36   ` Alec Warner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211002201125.346005-2-sam@gentoo.org \
    --to=sam@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox