[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] Less-stuffed interfaces lens



On Thu, May 14, 2009 at 09:40:16AM -0700, David Lutterkort wrote:
> On Mon, 2009-05-11 at 14:05 +1000, Matt Palmer wrote:
> > Solved my earlier problem of not being able to write a simple
> > /etc/network/interfaces file, by fixing the lens.
> 
> As you've discovered, the interfaces lens needs a bit of work.

You're a true master of understatement, David.

> > I've attached both the lens and it's test spec, since it's a bit much to
> > paste.
> 
> A couple of questions:
> 
> > diff --git a/lenses/interfaces.aug b/lenses/interfaces.aug
> > index 98389e8..c437fe2 100644
> > --- a/lenses/interfaces.aug
> > +++ b/lenses/interfaces.aug
> > @@ -17,12 +17,12 @@ let eol        = Util.eol
> > (* Define separators *)
> > 
> > (* a line can be extended across multiple lines by making the last  *)
> > -(*  character a backslash, unless the line is a comment (see below)
> > *)
> > +(*  character a backslash *)
> > let sep_spc    =  del /([ \t]+|[ \t]*\\\\\n[ \t]*)/ " "
> > 
> > (* Define fields *)
> > -let sto_to_eol = store /([^\\# \t\n].*[^\\ \t\n]|[^\\ \t\n])/
> > -let sto_to_spc = store /[^\\# \t\n]+/
> > +let sto_to_eol = store /([^\\ \t\n].*[^\\ \t\n]|[^\\ \t\n])/ . eol
> > +let sto_to_spc = store /[^\\ \t\n]+/
> 
> The '#' character was not allowed there because it starts a comment; is
> that not true in all cases ?

See below...

> > let mapping = [ stanza_id "mapping"
> > -               . (comment|empty)+
> > -               . stanza_option
> > -               . (stanza_option|comment|empty)* ]
> > +               . eol
> > +               . (stanza_option|comment|empty)+ ]
> 
> Doesn't this disallow 'mapping # my favorite mapping\n...' ? I am far
> from an expert on interfaces syntax, but isn't that a legal line ?

Yes (well, not really, but it doesn't do what you think it does).  No (well,
sorta, but it doesn't do what you think it does).

> > (************************************************************************
> >   *                              IFACE
> > @@ -76,8 +77,8 @@ let mapping = [ stanza_id "mapping"
> > let iface   = [ stanza_id    "iface"
> >                . stanza_param "family"
> >                . stanza_param "method"
> > -              . (comment|empty)+
> > -              . ( stanza_option . (stanza_option|comment|empty)* )? ]
> > +              . eol
> > +              . (stanza_option|comment|empty)* ]
> 
> This seems to disallow end-of-line comments here, too.

Indeed it does.

> > diff --git a/lenses/tests/test_interfaces.aug
> > b/lenses/tests/test_interfaces.aug
> > index 62bbd20..9495b4a 100644
> > --- a/lenses/tests/test_interfaces.aug
> > +++ b/lenses/tests/test_interfaces.aug
> > @@ -4,13 +4,13 @@ module Test_interfaces =
> > # and how to activate them. For more information, see interfaces(5).
> > # The loopback network interface
> > 
> > -auto lo eth0 # Take me to the net
> > +auto lo eth0 #foo
> 
> I am now getting very confused with what are comments in the interfaces
> file vs. valid entries ... /me goes to read the man page.

Second line of the second paragraph of man 5 interfaces:

    Note that end-of-line comments are NOT supported, comments must be on a
    line of their own.

This is supported by the source to if{up,down}, also.  The unstated
rationale, I think, is to reduce the amount of quoting required.

I had to giggle a little at the citation of the manpage in the lens file. I
certainly wouldn't have guessed that the manpage had been consulted, given
the number of things that were Just Plain Wrong.

Some better pre-inclusion QA of lenses would be appreciated.  It's No Fun At
All loading up a lens that's part of the base distribution and having it
completely fail to work.  Some sort of quality guidelines for lenses, and
perhaps a "beta" set of lenses that can be selectively enabled by the end
user, would make it clearer whether I can expect to be spending hours making
something work or not (and budget time appropriately).


-- 
Matt Palmer - Systems Administrator

A view into the Anchor Engineroom: http://anchor.com.au/blog/
Web Hosting Knowledgebase: http://anchor.com.au/wiki/

Anchor Systems Pty Ltd - Hosting Heavyweights
W: http://www.anchor.com.u - E: support anchor com au
Phone: 1300 883 979 - Fax: 02 8296 5199


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]