Nmap Development mailing list archives

Re: Completed Lua 5.3 upgrade!


From: Daniel Miller <bonsaiviking () gmail com>
Date: Sat, 18 Jun 2016 11:00:59 -0500

Patrick,

I found another one. I'm bringing these all up on the list so we have a
record of the kinds of bugs that can happen in a Lua version upgrade. In
ntp-date.nse, we calculate a timestamp as a floating-point number, then
pass it via stdnse.format_timestamp to os.date, which expects an integer.
One way to fix this would be to ensure it's an integer before we pass it
in, but maybe we should use math.floor to clamp it down to an integer
within stdnse.format_timestamp? What do you think?

Dan

patch to do it in stdnse.lua:
diff --git a/nselib/stdnse.lua b/nselib/stdnse.lua
index 9662197..0d9d48c 100644
--- a/nselib/stdnse.lua
+++ b/nselib/stdnse.lua
@@ -554,7 +554,7 @@ function format_timestamp(t, offset)
   else
     local tz_string = format_tz(offset)
     offset = offset or 0
-    return date("!%Y-%m-%dT%H:%M:%S", t + offset) .. tz_string
+    return date("!%Y-%m-%dT%H:%M:%S", floor(t + offset)) .. tz_string
   end
 end


On Fri, Jun 17, 2016 at 7:43 PM, Patrick Donnelly <batrick () batbytes com>
wrote:

On Wed, Jun 8, 2016 at 9:31 PM, Patrick Donnelly <batrick () batbytes com>
wrote:
Without further ado, here's the branch:

https://github.com/batrick/nmap/tree/nse-lua53

If there are no questions/comments/complaints/objections, I'd like to
merge the branch sometime around next Friday. All feedback is still
welcome!

--
Patrick Donnelly
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: