]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-selftest: fix behaviour if oe-selftest.log is a dangling symlink
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 22 Dec 2016 03:13:57 +0000 (16:13 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 9 Jan 2017 13:34:29 +0000 (13:34 +0000)
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>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/oe-selftest

index e166521238691c99bfa97b68eac9e15d7a64fb32..adfa92f7075cfb3c60a967f88263849b0201eac1 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")