[augeas-devel] [PATCH] Basic support for case insensitive square lens

David Lutterkort lutter at redhat.com
Wed Feb 23 01:54:32 UTC 2011


On Wed, 2011-02-16 at 23:32 -0500, Francis Giraldeau wrote:
> On Wed, 2011-02-16 at 17:02 -0800, David Lutterkort wrote:
> > On Tue, 2011-02-08 at 23:15 -0500, Francis Giraldeau wrote:
> > > lt-augparse: put.c:236: split_concat: Assertion `regs.start[reg] != -1' failed.
> > 
> > I need to look into this - not quite clear to me what's missing there.
> 
> Could it be that when case insensitive is set, the number of groups in
> the regexp is modified?

No, that shouldn't happen - though for some mixed-case regexps, there's
a nasty amount of rewriting going on. For example if you have
'key /a/i . del /b/', to get the ctype of the overall lens, the first
regexp needs to be rewritten as /[aA]/, to get the ctype /[aA]b/. The
rewriting bit (ultimately in fa_expand_nocase in fa.c) should be safe
wrt to parens, but that's only a 'should'.

> > > diff --git a/src/put.c b/src/put.c
> > > index 32618c4..66030bb 100644
> > > --- a/src/put.c
> > > +++ b/src/put.c
> > > @@ -468,12 +468,7 @@ static void put_del(ATTRIBUTE_UNUSED struct lens *lens, struct state *state) {
> > >      assert(lens->tag == L_DEL);
> > >      assert(state->skel != NULL);
> > >      assert(state->skel->tag == L_DEL);
> > > -    if (lens->string != NULL) {
> > >      fprintf(state->out, "%s", state->skel->text);
> > > -    } else {
> > > -    /* L_DEL with NULL string: replicate the current key */
> > > -        fprintf(state->out, "%s", state->key);
> > > -    }
> > >  }
> > 
> > What's happening here ? Why don't we special case the square lens
> > anymore ?
> 
> If the tags doesn't match in case, then to respect the GetPut function,
> the right case must be put back. In the case of create only we copy the
> key. This code was right when the both case were assumed to be the same.

Aah .. yeah, makes sense.

David





More information about the augeas-devel mailing list