openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.3k stars 2.51k forks source link

luci.model.uci.Cursor.section() accepts names with spaces, but doesn't actually work #2047

Closed karlp closed 6 years ago

karlp commented 6 years ago

The code returns as expected, returning the name of the section, but no section is created.

good case, followed by bad case

# lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio (double int32)
> lm = require("luci.model.uci")
> c = lm.cursor()
> data = {somekey = "textvalue", otherkey = 9876 }
> name1 = "nospaces"
> =c:section("someconfig", "sometype", name1, data)
nospaces
> =c:save("someconfig")
true
> =c:commit("someconfig")
true    nil
> >>>> at this point we cat the config file, and see the "nospaces" section exists
> name2 = "now with spaces"
> =c:section("someconfig", "sometype", name2, data)
now with spaces
> =c:save("someconfig")
true
> =c:commit("someconfig")
true    nil
> 
# cat /etc/config/someconfig 

config blah
    option wop 'dedo'

config sometype 'nospaces'
    option otherkey '9876'
    option somekey 'textvalue'

Note that the "now with spaces" section is never created.

jow- commented 6 years ago

Preliminary fixes pushed to https://git.openwrt.org/?p=project/rpcd.git;a=summary - will update the rpcd package tomorrow after some more testing.

karlp commented 6 years ago

This is now fixed on 1806 branch based as well as master, thanks!