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

Laine Stump laine at laine.org
Thu Sep 13 19:45:26 UTC 2012


On 09/05/2012 10:24 AM, Hendrik Schwartke wrote:
> 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);

Not knowing enough about augeas to say if this did exactly what you
wanted, I went to the source and asked the author of augeas (David
Lutterkort). He says it will do what you want, so it's go my ACK.

Pushing momentarily...


More information about the netcf-devel mailing list