All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Sakoman <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][dunfell 09/14] cve-check: fix symlinks where link and output path are equal
Date: Wed, 11 May 2022 08:19:28 -1000	[thread overview]
Message-ID: <62965ca8ca7077c12d75dac37efe204d7159cddd.1652292852.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1652292852.git.steve@sakoman.com>

From: Davide Gardenal <davidegarde2000@gmail.com>

An if statement now checks if the link and output path are
the same, if they are then the link is not created,
otherwise it is.

Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
(cherry picked from commit 2f024c0236c4806f0e59e4ce51a42f6b80fdf1b3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/classes/cve-check.bbclass | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass
index 350ed8ec39..ac9f0fb22c 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -117,10 +117,11 @@ python cve_save_summary_handler () {
 
         if cve_summary_file and os.path.exists(cve_summary_file):
             cvefile_link = os.path.join(cvelogpath, cve_summary_name)
-
-            if os.path.exists(os.path.realpath(cvefile_link)):
-                os.remove(cvefile_link)
-            os.symlink(os.path.basename(cve_summary_file), cvefile_link)
+            # if the paths are the same don't create the link
+            if cvefile_link != cve_summary_file:
+                if os.path.exists(os.path.realpath(cvefile_link)):
+                    os.remove(cvefile_link)
+                os.symlink(os.path.basename(cve_summary_file), cvefile_link)
 
         json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON"))
         json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp))
@@ -193,10 +194,12 @@ python cve_check_write_rootfs_manifest () {
 
         if manifest_name and os.path.exists(manifest_name):
             manifest_link = os.path.join(deploy_dir, "%s.cve" % link_name)
-            # If we already have another manifest, update symlinks
-            if os.path.exists(os.path.realpath(manifest_link)):
-                os.remove(manifest_link)
-            os.symlink(os.path.basename(manifest_name), manifest_link)
+            # if they are the same don't create the link
+            if manifest_link != manifest_name:
+                # If we already have another manifest, update symlinks
+                if os.path.exists(os.path.realpath(manifest_link)):
+                    os.remove(manifest_link)
+                os.symlink(os.path.basename(manifest_name), manifest_link)
             bb.plain("Image CVE report stored in: %s" % manifest_name)
 
         link_path = os.path.join(deploy_dir, "%s.json" % link_name)
-- 
2.25.1



  parent reply	other threads:[~2022-05-11 18:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 18:19 [OE-core][dunfell 00/14] Patch review Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 01/14] fribidi: Add fix for CVE-2022-25308, CVE-2022-25309 and CVE-2022-25310 Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 02/14] libinput: Add fix for CVE-2022-1215 Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 03/14] busybox: fix CVE-2022-28391 Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 04/14] linux-yocto/5.4: update to v5.4.192 Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 05/14] cve-check: no need to depend on the fetch task Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 06/14] cve-update-db-native: update the CVE database once a day only Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 07/14] cve-update-db-native: let the user to drive the update interval Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 08/14] cve-check: add JSON format to summary output Steve Sakoman
2022-05-11 18:19 ` Steve Sakoman [this message]
2022-05-11 18:19 ` [OE-core][dunfell 10/14] volatile-binds: Change DefaultDependencies from false to no Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 11/14] rootfs-postcommands: fix symlinks where link and output path are equal Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 12/14] base: Avoid circular references to our own scripts Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 13/14] scripts: Make git intercept global Steve Sakoman
2022-05-11 18:19 ` [OE-core][dunfell 14/14] scripts/git: Ensure we don't have circular references Steve Sakoman

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=62965ca8ca7077c12d75dac37efe204d7159cddd.1652292852.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.