[augeas-devel] put to inittab is order-dependent

Dominic Cleal dcleal at redhat.com
Mon Oct 22 18:25:50 UTC 2012


On 22/10/12 09:37, Matthew Booth wrote:
> I just created a bug for $SUBJECT here:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=868822
> 
> Has anyone seen this before? Looks weird.

Yes, it's quite normal.  People often notice it with when they come to
add new nodes that belong in the middle of a "record", but using aug_set
causes the new node to appear at the end (e.g. setting an fstab option
causes the node to appear after passno).  Use of aug_ins is needed to
specify the node position.

The order of nodes is set by the lens, which is governed by the file
format and parsing of that format.  If an inittab entry could be
represented (unambiguously) as process, then action, then runlevels,
then you could also process that tree in the put direction.  Since it
can't be read in that format, it can't be written that way either.
Augeas can't reorder nodes in the tree to fit the lens, so the nodes
have to be created that way.

The error message, when you add some whitespace shows the format it
expects the tree to be in, based on the lens:

/augeas/files/etc/inittab/error/message =
  "Failed to match
    { /runlevels/ = /[^\\001-\\004\\n#:]*/ }
    { /action/ = /[^\\001-\\004\\n#:]*/ }
    { /process/ = /[^\\001-\\004\\n#]*/ }
    { /#comment/ = <snipped> }?
  with tree
    { \"process\" = \"/sbin/mingetty tty\" }
    { \"action\" = \"respawn\" }
    { \"runlevels\" = \"2345\" }"

Regards,

-- 
Dominic Cleal
Red Hat Consulting
m: +44 (0)7817 878113




More information about the augeas-devel mailing list