]> git.e2factory.org Git - e2factory.git/commitdiff
environment: quote environment vars to allow expansion
authorTobias Ulmer <tu@emlix.com>
Tue, 1 Nov 2016 17:51:37 +0000 (18:51 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
shquote() breaks backwards compat

Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/environment.lua

index f65717b3a54e0b48959b1f5e7cecbed1232ca163..9f23f86d6822723e927aad701f0bdb49d7387b2f 100644 (file)
@@ -114,8 +114,7 @@ function environment.get_dict(env)
 end
 
 --- Write environment as key=value\n... string to file. File is created or
--- truncated. Value is quoted with e2lib.shquote() so the file can be sourced
--- by a shell.
+-- overwritten.
 -- @param env Environment.
 -- @param file File name.
 -- @return True on success, false on error.
@@ -128,7 +127,8 @@ function environment.tofile(env, file)
 
     out = {}
     for var, val in env:iter() do
-        table.insert(out, string.format("%s=%s\n", var, e2lib.shquote(val)))
+        -- no e2lib.shquote(), some projects depend on shell variable expansion
+        table.insert(out, string.format("%s=\"%s\"\n", var, val))
     end
 
     rc, re = eio.file_write(file, table.concat(out))