Hello David,

 

thank you for your helpful explaination. This is what I have learned from it:

 

- Use '[ lns . bare ] | [ lns . quoted ]' if lns will have different 
labels/keys in either situation.

- Use '[ lns . ( bare | quoted ) ]' when the keys/labels will be identical 
anyway.

 

Even though Augeas does not make decisions solely based on the keys/labels, 
that is the primary guideline. Is this correct?

 

With a sligthly different explaination, I've written documentation on the error 
"overlapping lenses in union.put" on the Augeas wiki 
(https://github.com/hercules-team/augeas/wiki/List-of-frequent-errors#overlapping-lenses-in-unionput).
 The key argument there, too, is, that the keys for the tree nodes must be 
different to make Augeas happy.

 

Ciao,

Xavier.

 

From: David Lutterkort [mailto:[email protected]] 
Sent: Tuesday, February 23, 2016 12:32 AM
To: Mol, Xavier (SCC)
Cc: Raphaël Pinson; [email protected]
Subject: Re: [augeas-devel] Non-empty string from get has turned into empty 
node for put direction - why?

 

On Mon, Dec 21, 2015 at 3:51 AM, Mol, Xavier (SCC) <[email protected]> wrote:

I have altered Quote.dquote_spaces such that '#' in unquoted values are no 
longer accepted and the final statement looks like this:

 

[ lns . (bare|quoted) ]

 

To me that is identical to what the Quote module states:

 

[ lns . bare ]|[ lns . quoted ]

 

But augtool disagrees. Can you maybe explain the difference (in put direction) 
here?

 

Yes, the difference is unfortunately terribly subtle: the first form says 
'create a node in the tree from text matching "lns . (bare|quoted)"'. When the 
time comes to write a tree back to disk, we recognize that we are looking at 
such a node by comparing the node's key* with whatever key or label statements 
are inside the "[ ... ]" and then use "lns . (bare|quoted)" to write out that 
node and its children.

The second form says 'create one of two possible nodes, depending on whether 
the text matches "lns . bare" or "lns .quoted"'. When we want to write out a 
tree with such a node, we first check whether that node matches "lns . bare" or 
"lns . quoted" and then proceed accordingly. To make that decision, the two 
constructs "[lns . bare]" and "[lns . quoted]" must match different kinds of 
tree nodes, i.e. it must be possible to make that decision from just looking at 
the key* of such a tree node. I assume that only "lns" in your example sets the 
key of a tree node; that means that Augeas can't determine whether it should 
use the first or the second "[ ... ]" in the overall construct. That's what it 
is complaining about with the error 'overlapping lenses in tree union.put': 
there's a construct "[ l1 ] | [ l2 ]", and at least for some tree nodes, both 
"[ l1 ]" and "[ l2 ]" would match so that Augeas can't tell which of these two 
to use.

I'd love to have a better error message for this situation (without the wall of 
text above ;)

David

*: Augeas actually doesn't just look at the keys of tree nodes, but also at 
their values to determine whether a tree node matches a lens.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to