lib/oeqa/decorators: handle broken links when creating new symlink
PATCH 1/1 lib/oeqa/decorators: handle broken links when creating new symlink
When checking if a link exists before creating it, use os.path.lexists() as otherwise os.path.exists() on a broken link will return False.
--- meta/lib/oeqa/utils/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/utils/decorators.py +1 -1
@@ -190,7 +190,7 @@ def LogResults(original_class): local_log.results("Testcase "+str(test_case)+": PASSED") # Create symlink to the current log - if os.path.exists(linkfile): + if os.path.lexists(linkfile): os.remove(linkfile) os.symlink(logfile, linkfile)
Signature · 1 line
2.8.1
Quoted 13 lines · Ross Burton
When checking if a link exists before creating it, use
os.path.lexists()as otherwiseos.path.exists()on a broken link will return False.Signed-off-by Ross Burton <[email protected]>--- meta/lib/oeqa/utils/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/lib/oeqa/utils/decorators.py +0
-0
meta/lib/oeqa/utils/decorators.py def LogResults(original_class): · line 193
Quoted 5 lines
meta/lib/oeqa/utils/decorators.py +1
-1@@ -190,7 +190,7 @@ def LogResults(original_class): local_log.results("Testcase "+str(test_case)+": PASSED") # Create symlink to the current log - if os.path.exists(linkfile): + if os.path.lexists(linkfile):
I think it will fail if the existing file is not a symlink ?
Quoted 11 lines
meta/lib/oeqa/utils/decorators.py +0
-1os.remove(linkfile) os.symlink(logfile, linkfile) --2.8.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 2 lines · Khem Raj
I think it will fail if the existing file is not a symlink ?
No, the only difference between lexists and exists is that exists follows links. So in the case of a broken link, exists returns false.
Ross
Yes ok
Quoted 12 lines · Ross
Quoted 2 lines · Khem Raj
I think it will fail if the existing file is not a symlink ?
No, the only difference between lexists and exists is that exists follows links. So in the case of a broken link, exists returns false.
Ross