[FS#1118] bad argument #1 to 'tonumber' (string expected, got nil)

LEDE Bugs lede-bugs at lists.infradead.org
Thu Oct 26 10:22:53 PDT 2017


A new Flyspray task has been opened.  Details are below. 

User who did this - Brian J. Murrell (brianjmurrell) 

Attached to Project - LEDE Project
Summary - bad argument #1 to 'tonumber' (string expected, got nil)
Task Type - Bug Report
Category - Packages
Status - Unconfirmed
Assigned To - 
Operating System - All
Severity - High
Priority - Very Low
Reported Version - lede-17.01
Due in Version - Undecided
Due Date - Undecided
Details - Supply the following if possible:
 - Device problem occurs on

Any device without iptables

 - Software versions of LEDE release, packages, etc.

17.01.04

 - Steps to reproduce
   
Build a firmware with luci and without iptables, flash it and then go to the router's status page:
http://dir-615/cgi-bin/luci/?status=1

You will get:


/usr/lib/lua/luci/dispatcher.lua:460: Failed to execute function dispatcher target for entry '/'.
The called action terminated with an exception:
/usr/lib/lua/luci/dispatcher.lua:460: Failed to execute firstchild dispatcher target for entry '/admin'.
The called action terminated with an exception:
/usr/lib/lua/luci/dispatcher.lua:460: Failed to execute function dispatcher target for entry '/admin/status'.
The called action terminated with an exception:
/usr/lib/lua/luci/dispatcher.lua:460: Failed to execute template dispatcher target for entry '/admin/status/overview'.
The called action terminated with an exception:
/usr/lib/lua/luci/template.lua:97: Failed to execute template 'admin_status/index'.
A runtime error occured: [string "/usr/lib/lua/luci/view/admin_status/index.h..."]:34: bad argument #1 to 'tonumber' (string expected, got nil)
stack traceback:
	[C]: in function 'assert'
	/usr/lib/lua/luci/dispatcher.lua:460: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:141: in function 
 

>From IRC:

(11:03:42 AM) jow: Shred00: but anyhow, try something along the lines of   `local conn_count = tonumber(s.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0`
(11:05:05 AM) Shred00: jow: yeah, that fixes it.
(11:05:17 AM) jow: Shred00: can you tell me the version of Lua installed on your system?
(11:05:38 AM) Shred00: lua - 5.1.5-1
(11:05:42 AM) jow: Shred00: and provide the output of  lua -e 'print(tonumber(nil))` ?
(11:06:02 AM) Shred00: # lua -e 'print(tonumber(nil))'
(11:06:02 AM) Shred00: nil
(11:06:20 AM) jow: I don't get it
(11:07:06 AM) jow: well anyhow, will add the fix to the repo later
(11:07:15 AM) jow: defensive programmis is never wrong
(11:07:18 AM) jow: *programming

More information can be found at the following URL:
https://bugs.lede-project.org/index.php?do=details&task_id=1118



More information about the lede-bugs mailing list