opentechinstitute / luci-commotion

Commotion configuration pages for the LuCI web interface
GNU General Public License v3.0
11 stars 17 forks source link

Adding app categories in luci produces error #441

Closed coreyreichle closed 9 years ago

coreyreichle commented 9 years ago

When attempting to add any new application categories, the following error is thrown: Failed to execute cbi dispatcher target for entry '/admin/commotion/apps/settings'. The called action terminated with an exception: ...sr/lib/lua/luci/model/cbi/commotion/app_settings.lua:51: attempt to perform arithmetic on a nil value stack traceback: [C]: in function 'assert' ?: in function 'dispatch' ?: in function <?:194>

Hardware: TP-Link WDR3600 Commotion Version: 1.1 Grumpy Cat URI: https://169.254.84.93/cgi-bin/luci/;stok=826c43427588ee4a5dfb21822b4cc2da/admin/commotion/apps/settings

seamustuohy commented 9 years ago

Looks like there was no expiration time set. Looks like a default expiration time, or a check for value submitted are in order.

See comments added to the code below. luci-commotion repo: luasrc/model/cbi/commotion/app_settings.lua - The code starts on line 42 and skips chunks with ... The error was found on line 51

--! ex_time_num.write
--! @brief Multiple the lifetime by the unit chosen to modify it to seconds.
function ex_time_num.write(self, section, value) -- takes the section and value passed by the browser
...
   local unit = ex_time_units:formvalue(section) -- the unit of time was set (I think it had a default)
...
      if unit == unt then
         value = tonumber(value) * num -- (Line 51)  Tries to compare a number to a nil value.
         sets = true
      end
...
coreyreichle commented 9 years ago

I'll test to verify that setting an expiration corrects the issue, so it can at least be flagged as "Workaround available"

dismantl commented 9 years ago

What was the value of the expiration time when you ran into this error? Was the "Force local applications to expire?" option checked or not?

coreyreichle commented 9 years ago

Force local apps to expire is unchecked when the error occurs.

coreyreichle commented 9 years ago

Just verified.

Checked "Force Local applications to expire", and the seconds field had a default of 84600 seconds. Edited field, and manually entered 84600, and error still occurs when saving the form.

Also, checked the force local app expiration, and left pre-filled field alone, and still, same error occurs.

So, in reality, there doesn't appear to be a work-around in luci, however, manual editing of conf file seems to work.

dismantl commented 9 years ago

I'm seeing the error too. I'll see if I can find the cause.

dismantl commented 9 years ago

fix here: https://github.com/opentechinstitute/luci-commotion/pull/442.

Thanks for submitting the issue!