From 22415d3ad088679a3da07a6611852a3aa77f6864 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Fri, 19 Apr 2024 18:20:42 +0200 Subject: [PATCH] fix: fix symlink handling (#4054) Fix symlink handling added by commit f13f559b8707cfa62c674ba414aa4b4f0c1888ad: if one of the file is a link, filenames list will be updated resulting in the loop ending before all links are removed. To avoid this issue, loop on a copy of filenames. Signed-off-by: Fabrice Fontaine --- cve_bin_tool/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cve_bin_tool/util.py b/cve_bin_tool/util.py index d0865a4f44..6c9d5b247c 100644 --- a/cve_bin_tool/util.py +++ b/cve_bin_tool/util.py @@ -364,7 +364,7 @@ def walk(self, roots: list[str] | None = None) -> Iterator[str]: for root in roots: for dirpath, dirnames, filenames in os.walk(root): # Filters - for filename in filenames: + for filename in filenames.copy(): try: if ( not self.pattern_match(