[autobuilder-helper,warrior,18/41] scripts/run-config: Handle quoting issues in buildtools environment files

Submitted by Richard Purdie on Sept. 10, 2020, 12:25 p.m. | Patch ID: 176298

Details

Message ID 20200910122553.2040430-18-richard.purdie@linuxfoundation.org
State New
Headers show

Commit Message

Richard Purdie Sept. 10, 2020, 12:25 p.m.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 scripts/run-config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/scripts/run-config b/scripts/run-config
index ce1f36f..b4f1d58 100755
--- a/scripts/run-config
+++ b/scripts/run-config
@@ -111,9 +111,11 @@  if bttarball:
     with open(btenv[0], "r") as f:
         for line in f.readlines():
             if line.startswith("export "):
-                line = line.split(" ", 1)[1].split("=", 1)
+                line = line.strip().split(" ", 1)[1].split("=", 1)
                 if "$PATH" in line[1]:
                     line[1] = line[1].replace("$PATH", os.environ["PATH"])
+                if line[1].startswith(("'", '"')):
+                    line[1] = line[1][1:-1]
                 os.environ[line[0]] = line[1]
 
 finalret = 0