[augeas-devel] [PATCH] Fix bug#144: wrong behavior of iter concat

David Lutterkort lutter at redhat.com
Tue Oct 26 22:54:48 UTC 2010


On Tue, 2010-10-26 at 16:43 -0400, Francis Giraldeau wrote:
> Le mardi 26 octobre 2010 à 11:21 -0700, David Lutterkort a écrit : 
> > Hi Francis,
> > 
> > On Fri, 2010-10-22 at 14:09 -0400, francis.giraldeau at usherbrooke.ca
> > wrote:
> > > diff --git a/src/get.c b/src/get.c
> > > index 11ea5de..9d420af 100644
> > > --- a/src/get.c
> > > +++ b/src/get.c
> > > @@ -572,6 +572,7 @@ static struct tree *get_quant_star(struct lens *lens, struct state *state) {
> > >  
> > >          t = get_lens(lens->child, state);
> > >          list_tail_cons(tree, tail, t);
> > > +        list_update_tail(tree, tail);
> > 
> > Why is a new macro needed here ? The list_tail_cons macro should already
> > maintain tail as the tail of the list tree. If it doesn't, there's a bug
> > in it.
> 
> It has a bug only on the first call, when tail is NULL. If tree has more
> than one node, the tail is not updated appropriately. 

Ugh .. I am amazed things worked this long with such a fundamental bug.
I shuffled your patch around a little - I wanted to make it clearer in
list_tail_cons that the operation consists of two steps (append to list,
forward tail pointer)

I also found one case where this actually lead to an incorrect tree in
the tests (in test_interfaces.aug).

If you are ok with the attached patch, feel free to push it.

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-src-list.h-list_tail_cons-behave-properly-when-ELT-i.patch
Type: text/x-patch
Size: 3432 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20101026/bc716b5b/attachment.bin>


More information about the augeas-devel mailing list