From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 06693158086 for ; Wed, 24 Nov 2021 17:06:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4DEFEE083D; Wed, 24 Nov 2021 17:06:16 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 38C09E083D for ; Wed, 24 Nov 2021 17:06:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 40A60343385 for ; Wed, 24 Nov 2021 17:06:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7AE40164 for ; Wed, 24 Nov 2021 17:06:13 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1637709752.3b3503bb2769b390e22a4fea42fa56fe4db4ddec.floppym@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/_dyn_libs/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/util/_dyn_libs/dyn_libs.py X-VCS-Directories: lib/portage/util/_dyn_libs/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 3b3503bb2769b390e22a4fea42fa56fe4db4ddec X-VCS-Branch: master Date: Wed, 24 Nov 2021 17:06:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f26de059-b193-4bef-8a07-5efd12804aae X-Archives-Hash: f45d61ce44dc21061373d8b5361e6dcd commit: 3b3503bb2769b390e22a4fea42fa56fe4db4ddec Author: Mike Gilbert gentoo org> AuthorDate: Tue Nov 23 22:39:24 2021 +0000 Commit: Mike Gilbert gentoo 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 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)