[bitbake-devel,dunfell,1.46,6/6] msg: Avoid issues where paths have relative components

Submitted by Steve Sakoman on June 30, 2020, 3:08 a.m. | Patch ID: 174075

Details

Message ID 436d6fe412397c2eaf7c1e1d3536eb45e4a31edb.1593486375.git.steve@sakoman.com
State New
Headers show

Commit Message

Steve Sakoman June 30, 2020, 3:08 a.m.
From: Richard Purdie <richard.purdie@linuxfoundation.org>

The autobuilder can end up using build/../ syntax which is an issue
if the build directory is cleaned. Avoid this by using normpath()
on the file path passed in.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 41988fec47eb196ab7195a75330a6d98de19101b)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bb/msg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/msg.py b/lib/bb/msg.py
index c0b344e3..2d88c4e7 100644
--- a/lib/bb/msg.py
+++ b/lib/bb/msg.py
@@ -280,7 +280,7 @@  def setLoggingConfig(defaultconfig, userconfigfile=None):
     logconfig = copy.deepcopy(defaultconfig)
 
     if userconfigfile:
-        with open(userconfigfile, 'r') as f:
+        with open(os.path.normpath(userconfigfile), 'r') as f:
             if userconfigfile.endswith('.yml') or userconfigfile.endswith('.yaml'):
                 import yaml
                 userconfig = yaml.load(f)