[OE-core] [PATCH] qemuboot.bbclass: Prevent creating a link loop

Mike Looijmans mike.looijmans at topic.nl
Thu Aug 17 13:43:18 UTC 2017


When IMAGE_NAME and IMAGE_LINK_NAME are equal, do_write_qemuboot_conf will
create a symlink that links to itself.

Check if this is the case before creating the link.

Signed-off-by: Mike Looijmans <mike.looijmans at topic.nl>
---
 meta/classes/qemuboot.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index 86b3060..0e21fc9 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -114,7 +114,8 @@ python do_write_qemuboot_conf() {
     with open(qemuboot, 'w') as f:
         cf.write(f)
 
-    if os.path.lexists(qemuboot_link):
-       os.remove(qemuboot_link)
-    os.symlink(os.path.basename(qemuboot), qemuboot_link)
+    if qemuboot_link != qemuboot:
+        if os.path.lexists(qemuboot_link):
+           os.remove(qemuboot_link)
+        os.symlink(os.path.basename(qemuboot), qemuboot_link)
 }
-- 
1.9.1




More information about the Openembedded-core mailing list