diff mbox series

[scarthgap,34/35] insane: handle dangling symlinks in the libdir QA check

Message ID 0c263b207a309e9cdf6f55ce72e3cc751041a47c.1719777887.git.steve@sakoman.com
State RFC
Delegated to: Steve Sakoman
Headers show
Series [scarthgap,01/35] wget: Fix for CVE-2024-38428 | expand

Commit Message

Steve Sakoman June 30, 2024, 8:07 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

The "libdir" QA check tries to open every file it finds as an ELF.  If
it finds a dangling symlink that looks like a library by the filename it
will try to open it and fail with FileNotFoundError error.  As this
dangling symlink probably points to a real file, silently absorb the
error.

[ YOCTO #13949 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit f044290f98ea66f2cecfbffd7d392dbc3d986da9)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/classes-global/insane.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index e963001d09..c32dfffd83 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -298,7 +298,7 @@  def package_qa_check_libdir(d):
                         try:
                             elf.open()
                             messages.append("%s: found library in wrong location: %s" % (package, rel_path))
-                        except (oe.qa.NotELFFileError):
+                        except (oe.qa.NotELFFileError, FileNotFoundError):
                             pass
                 if exec_re.match(rel_path):
                     if libdir not in rel_path and libexecdir not in rel_path:
@@ -307,7 +307,7 @@  def package_qa_check_libdir(d):
                         try:
                             elf.open()
                             messages.append("%s: found library in wrong location: %s" % (package, rel_path))
-                        except (oe.qa.NotELFFileError):
+                        except (oe.qa.NotELFFileError, FileNotFoundError):
                             pass
 
     if messages: