[OpenWrt-Devel] [UCI] uci import -m duplicates list options
Nemesis
nemesis at ninux.org
Fri Apr 15 06:15:25 EDT 2016
On 04/13/2016 01:33 PM, Yousong Zhou wrote:
> On 13 April 2016 at 18:54, Nemesis <nemesis at ninux.org> wrote:
>> Hi,
>>
>> I've incurred in weird behaviour when using the import feature of the uci
>> tool which seems to cause duplicates when importing configuration files that
>> have "list" settings.
>>
>> To test this you can try to create a file in /tmp/network:
>>
>> config interface 'lan'
>> list ipaddr '192.168.99.1/24'
>>
>> and then import it with:
>>
>> uci import -m -f /tmp/network network
>> uci commit network
>>
>> then import it again:
>>
>> uci import -m -f /tmp/network network
>> uci commit network
>>
>> results in:
>>
>> config interface 'lan'
>> list ipaddr '192.168.99.1/24'
>> list ipaddr '192.168.99.1/24'
>>
>> two questions:
>>
>> is this intended behaviour or is it a bug?
>> can something like this break the configuration or OpenWRT will select just
>> the last one?
>>
>> Thanks
>> Federico
>
> There is currently no rule against duplicate entries in list type
> options and there may exist a situation where values in a list are not
> unique to each other. So I guess the result is expected.
If the operation could be idempotent it would be nice.
Federico
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list