From: "Mike Gilbert" <floppym@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/_dyn_libs/
Date: Wed, 24 Nov 2021 17:06:13 +0000 (UTC) [thread overview]
Message-ID: <1637709752.3b3503bb2769b390e22a4fea42fa56fe4db4ddec.floppym@gentoo> (raw)
commit: 3b3503bb2769b390e22a4fea42fa56fe4db4ddec
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 23 22:39:24 2021 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Nov 23 23:22:32 2021 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3b3503bb
portage/util/_dyn_libs/dyn_libs.py: fix symlink recursion issue
Python's glob.glob() function follows symlinks recursively. Use
os.walk() instead.
Also re-order the operands to short-circuit the directory walk when
PROVIDES is not empty.
Bug: https://bugs.gentoo.org/826982
Fixes: cba2156dba89a22f2858238013469b4d80208854
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
lib/portage/util/_dyn_libs/dyn_libs.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/portage/util/_dyn_libs/dyn_libs.py b/lib/portage/util/_dyn_libs/dyn_libs.py
index 34b4bc926..ee28e8839 100644
--- a/lib/portage/util/_dyn_libs/dyn_libs.py
+++ b/lib/portage/util/_dyn_libs/dyn_libs.py
@@ -1,7 +1,15 @@
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-import glob
+import os
+
+
+def installed_dynlibs(directory):
+ for _dirpath, _dirnames, filenames in os.walk(directory):
+ for filename in filenames:
+ if filename.endswith(".so"):
+ return True
+ return False
def check_dyn_libs_inconsistent(directory, provides):
@@ -17,5 +25,4 @@ def check_dyn_libs_inconsistent(directory, provides):
# 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(directory + "/**/*.so", recursive=True)
- return installed_dynlibs and not provides
+ return not provides and installed_dynlibs(directory)
next reply other threads:[~2021-11-24 17:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 17:06 Mike Gilbert [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-10-28 5:00 [gentoo-commits] proj/portage:master commit in: lib/portage/util/_dyn_libs/ Sam James
2021-10-28 4:52 Sam James
2020-08-03 23:28 Zac Medico
2020-08-03 19:30 Zac Medico
2020-02-08 23:16 Zac Medico
2019-08-11 18:09 Zac Medico
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=1637709752.3b3503bb2769b390e22a4fea42fa56fe4db4ddec.floppym@gentoo \
--to=floppym@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-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