[augeas-devel] [PATCH] Add mysql.aug and associated test

Raphaël Pinson raphink at gmail.com
Wed Sep 3 20:06:31 UTC 2008


On Wed, Sep 3, 2008 at 1:36 AM, David Lutterkort <lutter at redhat.com> wrote:

> On Fri, 2008-08-29 at 15:09 +0200, Raphael Pinson wrote:
> > # HG changeset patch
> > # User Raphael Pinson <raphink at gmail.com>
> > # Date 1220015334 -7200
> > # Node ID 682d87344dedee300e0829e994ceab1f1baab318
> > # Parent  f6b7eed4d4d2a1e9bb598146f13a1e6fff9f4a4b
> > Add mysql.aug and associated test
>
> I get a test failure when I try to run this:
>
>        Test run encountered exception:
>        lenses/tests/test_mysql.aug:46.7-.25:exception: Get did not match
> entire input
>            Lens: lenses/inifile.aug:77.25-.43
>            Error encountered here (980 characters into string)
>            <ludedir /etc/mysql/conf.d/\n\n|=|>
>
> Could be the changes for '?' I just sent out.
>
> > +let entry    =
> > +      let kw = IniFile.entry_re in
> > +         [ key kw . (sep . sto_to_comment?)? . (comment|eol) ] | comment
>
> This shouldn't typecheck: assume the construct '(sep .
> sto_to_comment?)?' is parsed simply as 'sep'. During 'put', there's
> nothing in the tree that tells us whether 'sep' should be used or not.
>

That makes perfect sense indeed. Unfortunately, I believe that mysql.aug
supports both empty key/value pairs (i.e. 'field = \n') and flags (i.e.
'field\n').


This becomes clearer if you write '(sep . sto_to_comment?)?' as
> '(nothing|sep|sep . sto_to_comment)' where 'nothing' is a (hypothetical)
> lens that does nothing - when this construct is encountered at a tree
> node with no value during put, there's no way to know whether to use
> nothing.put or sep.put; right now, the implementation will opt for
> nothing.put, and therefore drop existing matches of 'sep' on the floor.
>

Ah yes, that's even clearer.


> The typechecker doesn't complain about this, so there's still something
> missing there.
>


I still don't really see how to fix that though, except by making two
separated lenses for entries and flags, which forces me to indicate the
names of the values for each kind, so they don't overlap on put.


Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080903/77c3c762/attachment.htm>


More information about the augeas-devel mailing list