[UPDATED] Can't Fetch Latest Git? Error when Creating Interface with Luci - section_id is not defined

This happens when I create a new interface and click "Create Interface." This is 100% reproducible.

When I click the button interface is added to Luci but I get an error message saying section_id not defined. However, the interface doesn't show up. This occurs for every protocol.

Then when I try to add an interface of the name I just tried to add, Luci complains that it already exists.

Firmware Version OpenWrt SNAPSHOT r16287-7fae64cc06 / LuCI Master git-21.078.34487-3d6713d
Kernel Version 5.4.105

Here is the full JavaScirpt stack trace:

Uncaught (in promise) ReferenceError: section_id is not defined
    click http://192.168.1.1/luci-static/resources/view/network/interfaces.js?v=git-21.078.34487-3d6713d:67
    promise callback*save http://192.168.1.1/luci-static/resources/form.js?v=git-21.078.34487-3d6713d:47
    click http://192.168.1.1/luci-static/resources/view/network/interfaces.js?v=git-21.078.34487-3d6713d:65
    promise callback*render/s.handleAdd/</<.click< http://192.168.1.1/luci-static/resources/view/network/interfaces.js?v=git-21.078.34487-3d6713d:64
    createHandlerFn http://192.168.1.1/luci-static/resources/ui.js?v=git-21.078.34487-3d6713d:305
    attr http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:116
    create http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:123
    E http://192.168.1.1/luci-static/resources/cbi.js?v=git-21.078.34487-3d6713d:121
    handleAdd http://192.168.1.1/luci-static/resources/view/network/interfaces.js?v=git-21.078.34487-3d6713d:63
    promise callback*render/s.handleAdd http://192.168.1.1/luci-static/resources/view/network/interfaces.js?v=git-21.078.34487-3d6713d:63
    createHandlerFn http://192.168.1.1/luci-static/resources/ui.js?v=git-21.078.34487-3d6713d:305
    attr http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:116
    create http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:123
    E http://192.168.1.1/luci-static/resources/cbi.js?v=git-21.078.34487-3d6713d:121
    renderSectionAdd http://192.168.1.1/luci-static/resources/form.js?v=git-21.078.34487-3d6713d:143
    renderContents http://192.168.1.1/luci-static/resources/form.js?v=git-21.078.34487-3d6713d:160
    promise callback*render http://192.168.1.1/luci-static/resources/form.js?v=git-21.078.34487-3d6713d:153
    renderChildren http://192.168.1.1/luci-static/resources/form.js?v=git-21.078.34487-3d6713d:34
    renderContents http://192.168.1.1/luci-static/resources/form.js?v=git-21.078.34487-3d6713d:48
    promise callback*render http://192.168.1.1/luci-static/resources/form.js?v=git-21.078.34487-3d6713d:48
    render http://192.168.1.1/luci-static/resources/view/network/interfaces.js?v=git-21.078.34487-3d6713d:86
    promise callback*__init__ http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:149
    super http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:22
    ClassConstructor http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:12
    compileClass http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:184
    promise callback*compileClass http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:180
    promise callback*require http://192.168.1.1/luci-static/resources/luci.js?v=git-21.078.34487-3d6713d:186
    instantiateView http://192.168.1.1/luci-static/resources/ui.js?v=git-21.078.34487-3d6713d:305
    <anonymous> http://192.168.1.1/cgi-bin/luci/admin/network/network:46
    promise callback* http://192.168.1.1/cgi-bin/luci/admin/network/network:45
luci.js:67:1

The code where this occurs is feeds/luci/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js about line 828, I believe.

The section_id seems to be removed in this commit: https://github.com/openwrt/luci/commit/7b5b7fbcd63af14658ad234cd39c076a823e4629#

For reference, here's the current file: https://github.com/openwrt/luci/blob/master/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js#L827

[UPDATE]

Upon further investigation I find that luci at the first revision:

$ git log interfaces.js
commit 3d6713dcc1969b1ef27f79589247ceed69ff657d (grafted)
Author: Hosted Weblate <hosted@weblate.org>
Date:   Fri Mar 19 05:16:28 2021 +0100

    Translated using Weblate (Chinese (Simplified))
    
    Currently translated at 100.0% (186 of 186 strings)
  ...

I've done a ./scripts/feed update -a and install as well. I've even tried git pull origin master, but the build is still out of date.

Could this be the cause of all the build errors?

1 Like

This was an actual bug introduced during refactoring + rebasing of an older feature branch. Fixed with https://github.com/openwrt/luci/commit/1c4284150dff9d37503f6f901d047c0caa9a3af0

1 Like

Dang it! I was so close to making that change and making a contribution to OpenWRT but you beat me to it! Haha.

Thanks. I'll try it out.