[augeas-devel] Example matched by two lenses: <nothing>

Mol, Xavier (SCC) xavier.mol at kit.edu
Thu Oct 22 15:28:52 UTC 2015


Hi again,

I probably just found the answer myself:

augtool> errors
Error in /tmp/gridmapfile (put_failed)
  Value '/C=DE/OU=KIT/CN=HAL9000 (Robot)' does not match regexp /[^" \t\n]+/ in store lens
  Lens: /usr/share/augeas/lenses/dist/gridmapfile.aug:17.15-.33:

Augeas tried to put with the wrong lens, but I don't understand why this happens. After all, the configuration file was successfully parsed with a different lens (the one in line 18). Though the counter to this problem seems easy: I swapped the application of lenses from line 17 and 18, now the lens for line 18 is matched first. So when Augeas puts the tree to file, it will always enclose the values from the tree in quotation marks, which is sometimes optional.

Sorry for the noise, but writing my thought to the mailling list did help me solve the problem on my own. Possibly other people will find the answer to the same question with Google in the future. :-)

Best regards,
Xavier.

> -----Original Message-----
> From: augeas-devel-bounces at redhat.com [mailto:augeas-devel-bounces at redhat.com] On Behalf Of Mol, Xavier (SCC)
> Sent: Thursday, October 22, 2015 5:11 PM
> To: augeas-devel at redhat.com
> Subject: [augeas-devel] Example matched by two lenses: <nothing>
> 
> Hello Augeas experts,
> 
> attached you can find a custom developed lens definition for Augeas together with a test for it. The problem with this lens is, that
> augparse complains about overlapping lenses, but doesn't show me a possible match for them. I cannot understand this error, even more
> so that all the real-world examples I came up with so far are successfully parsed without any issues.
> 
> 
> [root at some_host ~]# augparse /usr/share/augeas/lenses/dist/gridmapfile.aug
> Syntax error in lens definition
> /usr/share/augeas/lenses/dist/gridmapfile.aug:16.2-23.71:Failed to compile mapping
> /usr/share/augeas/lenses/dist/gridmapfile.aug:19.26-.38:exception: overlapping lenses in tree union.put
>     Example matched by both:
>     First lens: /usr/share/augeas/lenses/dist/gridmapfile.aug:17.15-.29:
>     Second lens: /usr/share/augeas/lenses/dist/gridmapfile.aug:18.17-.49:
> 
> 
> Can someone please explain to me why Augeas reports a syntax error? Since Augeas didn't use any quotation marks for its example, the
> possible match doesn't consist of white spaces exclusively. An empty line is not supposed to be matched by the lenses defined in line 17 or
> 18 either. In fact, the ctype regular expression of line 19, where the exception originated, looks like this:
> 
> /([^\t\n "]+|"[^\n"]*")/
> 
> So this matches anything but white space and quotation marks, or anything, possibly nothing, enclosed by quotations marks (excluding
> quotation marks and line breaks). I cannot think of any overlap here.
> 
> Thank you for your attention! Best regards,
> Xavier.
> 
> PS: Yes, I know about the Quote module, that offers lenses for matching strings that are optionally enclosed in quotation marks. But the
> problem with those is, that it seems very difficult to build trees with them.
> 
> 
> ****
> Karlsruher Institute of Technology (KIT)
> Steinbuch Centre for Computing (SCC)
> 
> B. Sc. Xavier Mol
> GridKa Storage Administrator and Support Manager
> 
> Hermann-von-Helmholtz-Platz 1
> Geb. 449
> 76344 Eggenstein-Leopoldshafen
> Phone: +49 721 608 23041
> Email: xavier.mol at kit.edu
> www.kit.edu
> KIT - University of the State of Baden-Württemberg and National Large-scale Research Center of the Helmholtz Association
> "Since 2010, the KIT has been certified as a family-friendly university."
> ****

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6401 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20151022/562e0547/attachment.p7s>


More information about the augeas-devel mailing list