From: Gordon Hecker Date: Thu, 4 Jun 2009 11:42:25 +0000 (+0200) Subject: Fix regression: Allow '.' in source/result names again. X-Git-Tag: e2factory-2.3.1pre1~1 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=f469a1bc8483ab75e7a8a77f10051e011f6fa8e3;p=e2factory.git Fix regression: Allow '.' in source/result names again. Signed-off-by: Gordon Hecker --- diff --git a/local/e2tool.lua b/local/e2tool.lua index 4935542..b9adf8f 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -2338,8 +2338,21 @@ end -- checks for valid characters in str local function checkFilenameInvalidCharacters(str) - if not str:match("^[-_0-9a-zA-Z/]+$") then - return false + local msg = "only digits, alphabetic characters, and '-_./' " .. + "are allowed" + if not str:match("^[-_0-9a-zA-Z/.]+$") then + return false, new_error(msg) + else + return true + end +end + +-- check for invalid characters in source/result names +local function checkNameInvalidCharacters(str) + local msg = "only digits, alphabetic characters, and '-_.' " .. + "are allowed" + if not str:match("^[-_0-9a-zA-Z.]+$") then + return false, new_error(msg) else return true end @@ -2358,11 +2371,10 @@ function e2tool.load_source_config(info) local list, re local path = e2tool.sourceconfig(src) local types = { "e2source", } - - if not checkFilenameInvalidCharacters(src) then - e:append("invalid source file name: %s") - e:append("only digits, alphabetic characters, and `-', `_' and `/' ".. - "are allowed") + local rc, re = checkFilenameInvalidCharacters(src) + if not rc then + e:append("invalid source file name: %s", src) + e:cat(re) return false, e end @@ -2387,10 +2399,10 @@ function e2tool.load_source_config(info) return false, e:append("`name' attribute missing in source config") end - if not name:match("^[-_0-9a-zA-Z.]+$") then - e:append("invalid source name: %s") - e:append("only digits, alphabetic characters, and `-', `_' and `.' ".. - "are allowed") + local rc, re = checkNameInvalidCharacters(name) + if not rc then + e:append("invalid source name: %s", name) + e:cat(re) return false, e end @@ -2414,10 +2426,10 @@ function e2tool.load_result_config(info) local path = e2tool.resultconfig(res) local types = { "e2result", } - if not checkFilenameInvalidCharacters(res) then - e:append("invalid result file name: %s") - e:append("only digits, alphabetic characters, and `-', `_' and `/' ".. - "are allowed") + local rc, re = checkFilenameInvalidCharacters(res) + if not rc then + e:append("invalid result file name: %s", res) + e:cat(re) return false, e end @@ -2440,10 +2452,10 @@ function e2tool.load_result_config(info) item.data.name = slashToDot(res) name = slashToDot(res) - if not name:match("^[-_0-9a-zA-Z.]+$") then + local rc, re = checkNameInvalidCharacters(name) + if not rc then e:append("invalid result name: %s",name) - e:append("only digits, alphabetic characters, and `-', `_' and `.' ".. - "are allowed") + e:cat(re) return false, e end