From: Peter Marko Date: Thu, 20 Mar 2025 12:15:33 +0000 (+0100) Subject: spdx30: handle links to inaccessible locations X-Git-Tag: 2025-04-walnascar~86 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26f35f866cf7888431963cf4fc5d2019cd28de74;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git spdx30: handle links to inaccessible locations This is the same as e105befbe4ee0d85e94c2048a744f0373e2dbcdf on additional place in the code. When a link is pointing to location inaccessible to build user (e.g. "/root/something"), filepath.is_file() throws "PermissionError: [Errno 13] Permission denied". Fix this by first checking if it is a link. Signed-off-by: Peter Marko Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py index 1841b0de4ae..1629ed69cee 100644 --- a/meta/lib/oe/spdx30_tasks.py +++ b/meta/lib/oe/spdx30_tasks.py @@ -1067,7 +1067,7 @@ def create_rootfs_spdx(d): filenames.sort() for fn in filenames: fpath = Path(dirpath) / fn - if not fpath.is_file() or fpath.is_symlink(): + if fpath.is_symlink() or not fpath.is_file(): continue relpath = str(fpath.relative_to(image_rootfs))