fix(luci-base): 修复 dnsmasq 编译选项正则匹配缺陷导致前端隐藏 DHCP-Options 的问题 - #417
Merged
Merged
Conversation
### 问题分析
在 `modules/luci-base/root/usr/share/rpcd/ucode/luci` 中探测 dnsmasq 功能时,原正则采用了:
`match(fd.read('all'), /^Compile time options: (.+)$/s)`
由于 `dnsmasq --version` 的第一行输出是版权与版本声明(例如 `Dnsmasq version 2.90...`),`Compile time options:` 实际在第二行。原正则中的 `^` 锚定在全文开头,导致 `m` 永远匹配失败(返回 `null`)。
这导致 `result.dnsmasq` 未能生成,前端 `L.hasSystemFeature('dnsmasq')` 恒为 `false`,使得 Web 界面【网络 -> 接口 -> LAN -> DHCP 服务器】中的【DHCP 选项】(DHCP-Options)、【强制】等关键输入框被错误隐藏。
### 修复方案
移除开头的全文锚定 `^`,使用 `/Compile time options: ([^\n]+)/` 捕获该行选项,确保 `result.dnsmasq` 正常注入,恢复 Web 界面 DHCP 选项的正常渲染与配置。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题分析
在
modules/luci-base/root/usr/share/rpcd/ucode/luci中探测 dnsmasq 功能时,原正则采用了:match(fd.read('all'), /^Compile time options: (.+)$/s)由于
dnsmasq --version的第一行输出是版权与版本声明(例如Dnsmasq version 2.90...),Compile time options:实际在第二行。原正则中的^锚定在全文开头,导致m永远匹配失败(返回null)。 这导致result.dnsmasq未能生成,前端L.hasSystemFeature('dnsmasq')恒为false,使得 Web 界面【网络 -> 接口 -> LAN -> DHCP 服务器】中的【DHCP 选项】(DHCP-Options)、【强制】等关键输入框被错误隐藏。修复方案
移除开头的全文锚定
^,使用/Compile time options: ([^\n]+)/捕获该行选项,确保result.dnsmasq正常注入,恢复 Web 界面 DHCP 选项的正常渲染与配置。Signed-off-by: <my@email.address>row (viagit commit --signoff)<package name>: titlefirst line subject for packagesPKG_VERSIONin the Makefile