Functions that use uci_lookup_ptr() internally, such as ctx.get(), ctx.set() or ctx.delete(), implicitly load the given configuration name while the higher level functions ctx.foreach() or ctx.get_first() do not.
This behaviour violates the principle of least surprise and might lead to non-deterministic program behavior as the outcome of these functions depends on prior uci operations performed on the cursor.
Fix this issue by invoking uci_load() internally in case the given uci package name cannot be found in the cursor's package cache.
Functions that use
uci_lookup_ptr()
internally, such asctx.get()
,ctx.set()
orctx.delete()
, implicitly load the given configuration name while the higher level functionsctx.foreach()
orctx.get_first()
do not.This behaviour violates the principle of least surprise and might lead to non-deterministic program behavior as the outcome of these functions depends on prior uci operations performed on the cursor.
Fix this issue by invoking
uci_load()
internally in case the given uci package name cannot be found in the cursor's package cache.Signed-off-by: Jo-Philipp Wich jo@mein.io