mailing list archives
[patch] Fixes for new Lua 5.2-isms
From: Daniel Miller <bonsaiviking () gmail com>
Date: Tue, 29 May 2012 10:51:54 -0500
While debugging, I found a few errors due to using old names of library
functions, like this one:
./nselib/rpc.lua:3365: attempt to call field 'mod' (a nil value)
./nselib/rpc.lua:3365: in function 'CalcFillBytes'
./nselib/rpc.lua:3052: in function 'unmarshall_vopaque'
./nselib/rpc.lua:920: in function 'Export'
./nselib/rpc.lua:2325: in function 'ShowMounts'
./scripts/nfs-showmount.nse:42: in function
So I went through the "Changes" sections of the Lua 5.2 and 5.1 manuals,
and checked for obvious fixes. Here's the mini-changelog I ended up with:
Fix math.mod (renamed to math.fmod in 5.1)
Fix foreach (now use for loop over pairs)
Replace string.gfind with string.gmatch (changed in 5.1)
Rename unpack to table.unpack (only when necessary, due to
bin.unpack, local unpack=table.unpack, etc. New in 5.2)
%z in patterns deprecated for \0 (deprecated in 5.2)
I think some of these 5.1-isms were covered by LUA_COMPAT* defines in
luaconf.h before the 5.2 change. Hopefully this patch will result in
better results from here forward.
Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/
- [patch] Fixes for new Lua 5.2-isms Daniel Miller (May 29)