[netcf-devel] [PATCH] Fix bug that eats config parameters which have identical names.

Hendrik Schwartke hendrik at os-t.de
Wed Sep 5 14:24:31 UTC 2012


Two (or more) nodes with identical names that are in the same
element are passed to libaugeas in such a way that only the last
node is actually written to the config file.
If e.g. there are two pre-up commands for a bridge on debian only
one is written to /etc/network/interfaces.
This fix changes this behaviour so that all of them are written.
---
 src/drv_debian.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drv_debian.c b/src/drv_debian.c
index 04953e3..1bf7558 100644
--- a/src/drv_debian.c
+++ b/src/drv_debian.c
@@ -679,7 +679,7 @@ static int aug_put_xml(struct netcf *ncf, xmlDocPtr xml) {
                     label = xml_prop(node, "label");
                     value = xml_prop(node, "value");
 
-                    r = aug_fmt_set(ncf, value, "%s/%s[%d]/%s",
+                    r = aug_fmt_set(ncf, value, "%s/%s[%d]/%s[last()+1]",
                                     network_interfaces_path,
                                     arraylabel, n, label ? label : "1");
                     ERR_COND_BAIL(r < 0, ncf, EOTHER);
-- 
1.7.9.5



More information about the netcf-devel mailing list