Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package lua-json

I've merge the next bugfix release of the 1.3 series to make lua-json
work at all again. 1.3.2 fixes/changes:

 - compatibility with lpeg 0.12
 - sets _ENV to nil using local _ENV = nil to avoid global writing
   this avoids problems in strict environments
 - enhance documentation and lpeg testing information.

thanks,

bernd

unblock lua-json/1.3.2-1

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/README b/README
index 7a79d97..8022ef5 100644
--- a/README
+++ b/README
@@ -12,16 +12,18 @@ Bug reports:
 
 Requirements
 	Lua 5.1, 5.2, or LuaJIT 2.0
-	LPeg (Tested with 0.7, 0.8, 0.9, 0.10 ... 0.6 mostly works)
+	LPeg (Tested with 0.7, 0.8, 0.9, 0.10, 0.12rc2 ... 0.6 mostly works)
 	For regressionTest:
 		lfs (Tested with 1.4.1)
 	For lunit-tests:
 		lunit >= 0.4
 
+NOTE: LPeg 0.11 may not work - it crashed during my tests
+
 Lua versions tested recently:
-    Lua 5.1.4 + strict
-    Lua 5.2.0
-    LuaJIT-2.0.0-beta10 + strict
+    Lua 5.1.4 + strict + pl.strict
+    Lua 5.2.0 + pl.strict
+    LuaJIT-2.0.0-beta10 + strict + pl.strict
 
 License
 	All-but tests: MIT-style, See LICENSE for details
@@ -58,6 +60,9 @@ Module/Function overview:
 	--null
 			Reference value to represent 'null' in a well-defined way to
 			allow for null values to be inserted into an array/table
+	--merge (t : table, ... : tables)
+			Shallow-merges a sequence of tables onto table t by iterating over each using
+			pairs and assigning.
 
 Attribution:
 	parsing test suite from JSON_checker project of http://www.json.org/
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index 7c33066..61ca4e3 120000
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -1 +1 @@
-docs/ReleaseNotes-1.3.1.txt
\ No newline at end of file
+docs/ReleaseNotes-1.3.2.txt
\ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
index cccca8f..d1f7fb2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+lua-json (1.3.2-1) unstable; urgency=medium
+
+  * [25eb09ad] Merge branch 'upstream'
+    Closes: #719519
+    Merging upstream version 1.3.2 which is a bugfix release
+    to make luajson work with lpeg again. It also sets _ENV to nil using local
+    _ENV = nil to avoid global writing.
+    Documentation and tests were updated accordingly and enhanced.
+  * [b2bdecd4] Remove transitional package.
+
+ -- Bernd Zeimetz <b...@debian.org>  Sat, 08 Nov 2014 16:31:39 +0100
+
 lua-json (1.3.1-1) unstable; urgency=medium
 
   * [3d18e710] Merge tag 'upstream/1.3.1'
diff --git a/debian/control b/debian/control
index a6462b3..4c32abe 100644
--- a/debian/control
+++ b/debian/control
@@ -17,12 +17,3 @@ Provides: liblua5.1-json, ${lua:Provides}
 XB-Lua-Versions: ${lua:Versions}
 Description: JSON decoder/encoder for Lua
  LuaJSON is a customizable JSON decoder/encoder using LPEG for parsing.
-
-Package: liblua5.1-json
-Section: oldlibs
-Priority: extra
-Architecture: all
-Depends: ${misc:Depends}, lua-json
-Description: Transitional package for lua-json
- This is a transitional package to ease upgrades to the lua-json
- package. It can safely be removed.
diff --git a/docs/ReleaseNotes-1.3.2.txt b/docs/ReleaseNotes-1.3.2.txt
new file mode 100644
index 0000000..3dc2dd8
--- /dev/null
+++ b/docs/ReleaseNotes-1.3.2.txt
@@ -0,0 +1,27 @@
+luajson v1.3.2 Release Notes
+============================
+
+User Visible Changes
+--------------------
+One of the main changes in this release is compatibility with LPeg 0.12 and
+more sane _ENV manipulation to avoid problems in strict environments.
+The documentation has also been updated to reflect the behavior of the
+often-used 'merge' utility to avoid surprises in behavior.
+
+Plans for next release
+----------------------
+A future release will have a stronger focus on decoder performance. It may
+mean a reduction in flexibility by removing options and breaking compatibility.
+
+Updates since 1.3.1
+===================
+
+Thomas Harning Jr (6):
+	all:
+		sets _ENV to nil using local _ENV = nil to avoid global writing
+	decoder:
+		fixes compatibility with lpeg 0.12 by closing off 0-length captures in loops
+	docs:
+		documents testing with the Penlight 'strict' module
+		adds merge behavior documentation
+		updates LPeg testing information
diff --git a/lua/json.lua b/lua/json.lua
index bfbbaff..b3e5400 100644
--- a/lua/json.lua
+++ b/lua/json.lua
@@ -8,7 +8,7 @@ local util = require("json.util")
 
 local _G = _G
 
-_ENV = nil
+local _ENV = nil
 
 local json = {
 	_VERSION = "1.3",
diff --git a/lua/json/decode.lua b/lua/json/decode.lua
index 739c2e8..b2c357c 100644
--- a/lua/json/decode.lua
+++ b/lua/json/decode.lua
@@ -22,7 +22,7 @@ local type = type
 
 local require = require
 
-_ENV = nil
+local _ENV = nil
 
 local modulesToLoad = {
 	"composite",
diff --git a/lua/json/decode/composite.lua b/lua/json/decode/composite.lua
index 945397f..cd9c289 100644
--- a/lua/json/decode/composite.lua
+++ b/lua/json/decode/composite.lua
@@ -18,7 +18,7 @@ local tostring = tostring
 local error = error
 local getmetatable = getmetatable
 
-_ENV = nil
+local _ENV = nil
 
 local defaultOptions = {
 	array = {
diff --git a/lua/json/decode/number.lua b/lua/json/decode/number.lua
index bcef556..94ed3b8 100644
--- a/lua/json/decode/number.lua
+++ b/lua/json/decode/number.lua
@@ -8,7 +8,7 @@ local jsonutil = require("json.util")
 local merge = jsonutil.merge
 local util = require("json.decode.util")
 
-_ENV = nil
+local _ENV = nil
 
 local digit  = lpeg.R("09")
 local digits = digit^1
diff --git a/lua/json/decode/others.lua b/lua/json/decode/others.lua
index adc3ea6..9fab7a8 100644
--- a/lua/json/decode/others.lua
+++ b/lua/json/decode/others.lua
@@ -9,7 +9,7 @@ local util = require("json.decode.util")
 
 -- Container module for other JavaScript types (bool, null, undefined)
 
-_ENV = nil
+local _ENV = nil
 
 -- For null and undefined, use the util.null value to preserve null-ness
 local booleanCapture =
diff --git a/lua/json/decode/state.lua b/lua/json/decode/state.lua
index 8a2f8fa..50556f8 100644
--- a/lua/json/decode/state.lua
+++ b/lua/json/decode/state.lua
@@ -10,7 +10,7 @@ local type = type
 local next = next
 local unpack = unpack
 
-_ENV = nil
+local _ENV = nil
 
 local state_ops = {}
 local state_mt = {
diff --git a/lua/json/decode/strings.lua b/lua/json/decode/strings.lua
index d0e796e..cb3b5cc 100644
--- a/lua/json/decode/strings.lua
+++ b/lua/json/decode/strings.lua
@@ -14,15 +14,15 @@ local table_concat = require("table").concat
 
 local error = error
 
-_ENV = nil
+local _ENV = nil
 
 local function get_error(item)
 	local fmt_string = item .. " in string [%q] @ %i:%i"
-	return function(data, index)
+	return lpeg.P(function(data, index)
 		local line, line_index, bad_char, last_line = util.get_invalid_character_info(data, index)
 		local err = fmt_string:format(bad_char, line, line_index)
 		error(err)
-	end
+	end) * 1
 end
 
 local bad_unicode   = get_error("Illegal unicode escape")
@@ -67,8 +67,8 @@ local function decodeX(code)
 end
 
 local doSimpleSub = lpeg.C(lpeg.S("'\"\\/bfnrtvz")) / knownReplacements
-local doUniSub = lpeg.P('u') * (lpeg.C(util.hexpair) * lpeg.C(util.hexpair) + lpeg.P(bad_unicode))
-local doXSub = lpeg.P('x') * (lpeg.C(util.hexpair) + lpeg.P(bad_hex))
+local doUniSub = lpeg.P('u') * (lpeg.C(util.hexpair) * lpeg.C(util.hexpair) + bad_unicode)
+local doXSub = lpeg.P('x') * (lpeg.C(util.hexpair) + bad_hex)
 
 local defaultOptions = {
 	badChars = '',
@@ -93,8 +93,8 @@ end
 
 local function buildCaptureString(quote, badChars, escapeMatch)
 	local captureChar = (1 - lpeg.S("\\" .. badChars .. quote)) + (lpeg.P("\\") / "" * escapeMatch)
-	captureChar = captureChar + (-#lpeg.P(quote) * lpeg.P(bad_character))
-	local captureString = captureChar^0
+	-- During error, force end
+	local captureString = captureChar^0 + (-#lpeg.P(quote) * bad_character + -1)
 	return lpeg.P(quote) * lpeg.Cs(captureString) * lpeg.P(quote)
 end
 
@@ -111,7 +111,7 @@ local function generateLexer(options)
 		escapeMatch = escapeMatch + options.additionalEscapes
 	end
 	if options.escapeCheck then
-		escapeMatch = options.escapeCheck * escapeMatch + lpeg.P(bad_escape)
+		escapeMatch = options.escapeCheck * escapeMatch + bad_escape
 	end
 	local captureString
 	for i = 1, #quotes do
diff --git a/lua/json/decode/util.lua b/lua/json/decode/util.lua
index 2249eba..b90c0b7 100644
--- a/lua/json/decode/util.lua
+++ b/lua/json/decode/util.lua
@@ -17,7 +17,7 @@ local table_concat = require("table").concat
 
 local merge = require("json.util").merge
 
-_ENV = nil
+local _ENV = nil
 
 local function get_invalid_character_info(input, index)
 	local parsed = input:sub(1, index)
@@ -33,7 +33,7 @@ local function build_report(msg)
 		local line, line_index, bad_char, last_line = get_invalid_character_info(data, pos)
 		local text = fmt:format(pos, line, line_index, bad_char, last_line)
 		error(text)
-	end)
+	end) * 1
 end
 local function unexpected()
 	local msg = "unexpected character"
diff --git a/lua/json/encode.lua b/lua/json/encode.lua
index 0d59150..e07a6b8 100644
--- a/lua/json/encode.lua
+++ b/lua/json/encode.lua
@@ -14,7 +14,7 @@ local output = require("json.encode.output")
 local util = require("json.util")
 local util_merge, isCall = util.merge, util.isCall
 
-_ENV = nil
+local _ENV = nil
 
 --[[
 	List of encoding modules to load.
diff --git a/lua/json/encode/array.lua b/lua/json/encode/array.lua
index 4efee1b..3744409 100644
--- a/lua/json/encode/array.lua
+++ b/lua/json/encode/array.lua
@@ -16,7 +16,7 @@ local math_floor, math_modf = math.floor, math.modf
 local jsonutil = require("json.util")
 local util_IsArray = jsonutil.IsArray
 
-_ENV = nil
+local _ENV = nil
 
 local defaultOptions = {
 	isArray = util_IsArray
diff --git a/lua/json/encode/calls.lua b/lua/json/encode/calls.lua
index 7d0cee2..11dddfe 100644
--- a/lua/json/encode/calls.lua
+++ b/lua/json/encode/calls.lua
@@ -13,7 +13,7 @@ local jsonutil = require("json.util")
 
 local isCall, decodeCall = jsonutil.isCall, jsonutil.decodeCall
 
-_ENV = nil
+local _ENV = nil
 
 local defaultOptions = {
 }
diff --git a/lua/json/encode/number.lua b/lua/json/encode/number.lua
index 6240e6a..290b440 100644
--- a/lua/json/encode/number.lua
+++ b/lua/json/encode/number.lua
@@ -7,7 +7,7 @@ local assert = assert
 local jsonutil = require("json.util")
 local huge = require("math").huge
 
-_ENV = nil
+local _ENV = nil
 
 local defaultOptions = {
 	nan = true,
diff --git a/lua/json/encode/object.lua b/lua/json/encode/object.lua
index c4c1d7f..4716d52 100644
--- a/lua/json/encode/object.lua
+++ b/lua/json/encode/object.lua
@@ -11,7 +11,7 @@ local tostring = tostring
 local table_concat = require("table").concat
 local jsonutil = require("json.util")
 
-_ENV = nil
+local _ENV = nil
 
 local defaultOptions = {
 }
diff --git a/lua/json/encode/others.lua b/lua/json/encode/others.lua
index 441d1c2..b527044 100644
--- a/lua/json/encode/others.lua
+++ b/lua/json/encode/others.lua
@@ -8,7 +8,7 @@ local assert = assert
 local jsonutil = require("json.util")
 local type = type
 
-_ENV = nil
+local _ENV = nil
 
 -- Shortcut that works
 local encodeBoolean = tostring
diff --git a/lua/json/encode/output.lua b/lua/json/encode/output.lua
index 2eea3ff..8293b62 100644
--- a/lua/json/encode/output.lua
+++ b/lua/json/encode/output.lua
@@ -13,7 +13,7 @@ local setmetatable = setmetatable
 
 local output_utility = require("json.encode.output_utility")
 
-_ENV = nil
+local _ENV = nil
 
 local tableCompositeCache = setmetatable({}, {__mode = 'v'})
 
diff --git a/lua/json/encode/output_utility.lua b/lua/json/encode/output_utility.lua
index 2d3941d..b6607d1 100644
--- a/lua/json/encode/output_utility.lua
+++ b/lua/json/encode/output_utility.lua
@@ -5,7 +5,7 @@
 local setmetatable = setmetatable
 local assert, loadstring = assert, loadstring or load
 
-_ENV = nil
+local _ENV = nil
 
 -- Key == weak, if main key goes away, then cache cleared
 local outputCache = setmetatable({}, {__mode = 'k'})
diff --git a/lua/json/encode/strings.lua b/lua/json/encode/strings.lua
index 65597cc..09d85a9 100644
--- a/lua/json/encode/strings.lua
+++ b/lua/json/encode/strings.lua
@@ -8,7 +8,7 @@ local pairs = pairs
 local jsonutil = require("json.util")
 local util_merge = jsonutil.merge
 
-_ENV = nil
+local _ENV = nil
 
 local normalEncodingMap = {
 	['"'] = '\\"',
diff --git a/lua/json/util.lua b/lua/json/util.lua
index dfdbf3b..d7d5d25 100644
--- a/lua/json/util.lua
+++ b/lua/json/util.lua
@@ -9,7 +9,7 @@ local pairs = pairs
 local getmetatable, setmetatable = getmetatable, setmetatable
 local select = select
 
-_ENV = nil
+local _ENV = nil
 
 local function foreach(tab, func)
 	for k, v in pairs(tab) do
@@ -59,6 +59,14 @@ local function inner_merge(t, remaining, from, ...)
 	return inner_merge(t, remaining - 1, ...)
 end
 
+--[[*
+    Shallow-merges tables in order onto the first table.
+
+    @param t table to merge entries onto
+    @param ... sequence of 0 or more tables to merge onto 't'
+
+    @returns table 't' from input
+]]
 local function merge(t, ...)
 	return inner_merge(t, select('#', ...), ...)
 end
diff --git a/rockspecs/luajson-1.3.1-1.rockspec b/rockspecs/luajson-1.3.1-1.rockspec
index cb2fd97..dc3bb6e 100644
--- a/rockspecs/luajson-1.3.1-1.rockspec
+++ b/rockspecs/luajson-1.3.1-1.rockspec
@@ -1,6 +1,8 @@
 package = "luajson"
 version = "1.3.1-1"
 source = {
+    url = "http://cloud.github.com/downloads/harningt/luajson/luajson-1.3.1.tar.gz";,
+    md5 = "1ef4751ea4a6e90f76a599d0b3f928f5"
 }
 description = {
 	summary = "customizable JSON decoder/encoder",
diff --git a/rockspecs/luajson-1.3.2-1.rockspec b/rockspecs/luajson-1.3.2-1.rockspec
new file mode 100644
index 0000000..ad17e00
--- /dev/null
+++ b/rockspecs/luajson-1.3.2-1.rockspec
@@ -0,0 +1,44 @@
+package = "luajson"
+version = "1.3.2-1"
+source = {
+    url = "http://cloud.github.com/downloads/harningt/luajson/luajson-1.3.2.tar.gz";
+}
+description = {
+	summary = "customizable JSON decoder/encoder",
+	detailed = [[
+		LuaJSON is a customizable JSON decoder/encoder using
+		LPEG for parsing.
+	]],
+	homepage = "http://github.com/harningt/luajson";,
+	maintainer = "Thomas Harning <harni...@gmail.com>",
+	license = "MIT/X11"
+}
+dependencies = {
+	"lua >= 5.1",
+	"lunit >= 0.4",
+	"lpeg >= 0.8.1"
+}
+build = {
+	type = "module",
+	modules = {
+		["json"] = "lua/json.lua",
+		["json.decode"] = "lua/json/decode.lua",
+		["json.decode.composite"] = "lua/json/decode/composite.lua",
+		["json.decode.number"] = "lua/json/decode/number.lua",
+		["json.decode.others"] = "lua/json/decode/others.lua",
+		["json.decode.state"] = "lua/json/decode/state.lua",
+		["json.decode.strings"] = "lua/json/decode/strings.lua",
+		["json.decode.util"] = "lua/json/decode/util.lua",
+		["json.encode"] = "lua/json/encode.lua",
+		["json.encode.array"] = "lua/json/encode/array.lua",
+		["json.encode.calls"] = "lua/json/encode/calls.lua",
+		["json.encode.number"] = "lua/json/encode/number.lua",
+		["json.encode.object"] = "lua/json/encode/object.lua",
+		["json.encode.others"] = "lua/json/encode/others.lua",
+		["json.encode.output"] = "lua/json/encode/output.lua",
+		["json.encode.output_utility"] = "lua/json/encode/output_utility.lua",
+		["json.encode.strings"] = "lua/json/encode/strings.lua",
+		["json.util"] = "lua/json/util.lua"
+	}
+}
+

Reply via email to