On 13/07/2023 18:53, Hauke Mehrtens wrote:
Without this change we see the following error:
# uci -m import optic < /etc/optic-db/default
uci: Parse error (option/list command found before the first section) at
line 4, byte 1
ptr.last is still a null pointer in case the uci_lookup_list() call
found a matching section and set ptr.s to it. The code expects that
uci_set() updates the ptr.last pointer, but this is not done any more
Ah snap, I overlooked that in uci_parse_config while working on uci_set.
A clearer fix might be to just change the last line of uci_parse_config to:
pctx->section = ptr.s;
The change to uci_parse_option does not do anything, ptr->last is never
read after being set.
However, seeing this made me more convinced that ptr.last just
complicates the code while being redundant anyway. So I created a patch
that removes internal usage of ptr.last altogether. Would you please be
so kind to take a look at it?
https://patchwork.ozlabs.org/project/openwrt/list/?series=363985
While your at it, maybe you could also take a look at these other
patches for uci?
https://patchwork.ozlabs.org/project/openwrt/patch/20221120010927.23856-2-...@venekamp.net/
https://patchwork.ozlabs.org/project/openwrt/patch/sy4p282mb39395204ae37bc45d35d834cc5...@sy4p282mb3939.ausp282.prod.outlook.com/
Kind regards,
Jan Venekamp
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel