]> git.e2factory.org Git - e2factory.git/commitdiff
In e2-new-source, quote arguments for sha1sum, curl, and mv
authorTobias Ulmer <tu@emlix.com>
Tue, 10 Jul 2012 12:57:18 +0000 (14:57 +0200)
committerTobias Ulmer <tu@emlix.com>
Tue, 10 Jul 2012 12:57:18 +0000 (14:57 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/new-source.lua

index 7306f32eb69d4c51c232b2ddc9c8fe0d18fb7715..b99c4cacac5f76f9a5368aab7670387a694704b3 100644 (file)
@@ -116,10 +116,10 @@ end
 -- @return bool
 -- @return nil, an error string on error
 function write_checksum_file_sha1(source_file, checksum_file)
-       e2lib.log(4, string.format("write_checksum_file_sha1(%s, %s)", 
+       e2lib.log(4, string.format("write_checksum_file_sha1(%s, %s)",
                                        source_file, checksum_file))
-       local cmd = string.format("sha1sum \"%s\" >\"%s\"", source_file, 
-                                                               checksum_file)
+       local cmd = string.format("sha1sum %s > %s",
+          e2lib.shquote(source_file), e2lib.shquote(checksum_file))
        local rc = e2lib.callcmd_capture(cmd)
        if rc ~= 0 then
                return false, "error writing checksum file"
@@ -129,8 +129,8 @@ end
 
 function download(f)
        local name = e2lib.basename(f)
-       local cmd = string.format("curl --silent --fail \"%s\" >\"%s\"", f, 
-                                                                       name)
+       local cmd = string.format("curl --silent --fail %s > %s",
+          e2lib.shquote(f), e2lib.shquote(name))
        local rc = e2lib.callcmd_capture(cmd)
        if rc ~= 0 then
                return false, new_error("download failed: %s", f)
@@ -139,7 +139,8 @@ function download(f)
 end
 
 function mv(s, d)
-       local cmd = string.format("mv \"%s\" \"%s\"", s, d)
+       local cmd = string.format("mv %s %s", e2lib.shquote(s),
+          e2lib.shquote(d))
        local rc = e2lib.callcmd_capture(cmd)
        if rc ~= 0 then
                return false, "mv failed"