uci -m import duplicates list entries on repeated imports
Username: Martin Tippmann
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=536
I want to merge settings to an already existing uci config file with a script in /etc/uci-defaults
uci provides an -m option for merging settings. This works fine with options but ‘list’ settings are duplicated.
I’d thought that merging should not duplicate the list entries - and have the same behavior with the option entries.
How to reproduce:
create a script i.e. 10-test-uci-import.sh
#!/bin/sh
. /lib/functions.sh
uci -m import test <<-EOF config 'beispiel' 'grob' option 'string' 'Folge von Zeichen' option 'boolean' '0' option 'foobar' 'bar' option 'bar' 'baz' list 'collection' 'erstes item' list 'collection' 'zweites item' EOF
Run the script twice
. 10-test-uci-import.sh
uci commit
. 10-test-uci-import.sh
uci commit
The resulting file /etc/config/test now has duplicate list entries:
cat /etc/config/test
config beispiel 'grob' option string 'Folge von Zeichen' option boolean '0' option foobar 'bar' option bar 'baz' list collection 'erstes item' list collection 'zweites item' list collection 'erstes item' list collection 'zweites item'
There should be only 2 list collection items.