From 119aeff2c70e9890b788a9a4e8b6300f64668280 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 5 Apr 2010 17:44:57 +0000 Subject: [PATCH] luci-0.9: fix various uvl issues --- libs/uvl/luasrc/uvl.lua | 2 +- libs/uvl/luasrc/uvl/errors.lua | 6 +++--- libs/uvl/root/usr/bin/uvl | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua index d2ea4bd2c..f9a93e6d1 100644 --- a/libs/uvl/luasrc/uvl.lua +++ b/libs/uvl/luasrc/uvl.lua @@ -278,7 +278,7 @@ function UVL._validate_section( self, section ) if STRICT_UNKNOWN_OPTIONS and not section:scheme('dynamic') then for k, v in pairs(section:config()) do local oo = section:option(k) - if k:byte(1) == 46 and not self.beenthere[oo:cid()] then + if k:byte(1) ~= 46 and not self.beenthere[oo:cid()] then section:error(ERR('OPT_UNKNOWN', oo)) end end diff --git a/libs/uvl/luasrc/uvl/errors.lua b/libs/uvl/luasrc/uvl/errors.lua index fa177fb76..aa13317cc 100644 --- a/libs/uvl/luasrc/uvl/errors.lua +++ b/libs/uvl/luasrc/uvl/errors.lua @@ -19,8 +19,8 @@ local uvl = require "luci.uvl" local util = require "luci.util" local string = require "string" -local luci, tonumber, unpack, ipairs, type = - luci, tonumber, unpack, ipairs, type +local luci, tonumber, tostring, unpack, ipairs, type = + luci, tonumber, tostring, unpack, ipairs, type module "luci.uvl.errors" @@ -128,7 +128,7 @@ function error.string(self,pad) :gsub("%%s", self.section or '(nil)') :gsub("%%S", self.stype or '(nil)') :gsub("%%o", self.option or '(nil)') - :gsub("%%v", self.value or '(nil)') + :gsub("%%v", self.value and tostring(self.value) or '(nil)') :gsub("%%t", self.object and self.object:type() or '(nil)' ) :gsub("%%T", self.object and self.object:title() or '(nil)' ) :gsub("%%([1-9])", function(n) return self.args[tonumber(n)] or '(nil)' end) diff --git a/libs/uvl/root/usr/bin/uvl b/libs/uvl/root/usr/bin/uvl index e5db5c304..01813b3f3 100755 --- a/libs/uvl/root/usr/bin/uvl +++ b/libs/uvl/root/usr/bin/uvl @@ -216,7 +216,7 @@ elseif arguments[1] == "verify" or arguments[1] == "verify-scheme" then ) ok, err = uvl:validate_config( cso[1], uci:get_all(cso[1]) ) - if err then err.code = luci.uvl.errors.ERR_SCHEME end + if err then err.code = 'SCHEME' end else ok, err = uvl:validate( unpack(cso) ) end -- 2.25.1