Skip to contentSkip to conversation

qemuboot.bbclass: Prevent creating a link loop

PATCH New Mike Looijmans 1 participant 1 message Aug 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemuboot.bbclass: Prevent creating a link loop

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.

---
 meta/classes/qemuboot.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/qemuboot.bbclass +4 -3
index 86b3060..0e21fc9 100644
@@ -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)
 }
Signature · 1 line
1.9.1