]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oe-selftest: fix behaviour if oe-selftest.log is a dangling symlink
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 23 Nov 2016 02:00:00 +0000 (15:00 +1300)
committerPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 22 Dec 2016 03:12:51 +0000 (16:12 +1300)
If you delete the log file that the oe-selftest.log symlink points to
but not the symlink itself, because we were using os.path.exists() here
the code assumed that the symlink didn't exist when in fact it still
did. Use os.path.lexists() instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
scripts/oe-selftest

index bfcea66f1c70db79fcba55d28143787061982043..1f11a060893dc1b5f6a34c4c1e13025f3cafa5f6 100755 (executable)
@@ -62,7 +62,8 @@ log_prefix = "oe-selftest-" + t.strftime("%Y%m%d-%H%M%S")
 
 def logger_create():
     log_file = log_prefix + ".log"
-    if os.path.exists("oe-selftest.log"): os.remove("oe-selftest.log")
+    if os.path.lexists("oe-selftest.log"):
+        os.remove("oe-selftest.log")
     os.symlink(log_file, "oe-selftest.log")
 
     log = logging.getLogger("selftest")