Hi Raphaël.
> An empty file contains "\n", not "". So what you are saying is, that Augeas doesn't understand the concept of empty files? It will always interpret them as beeing filled with an empty line (which translates into an empty tree node)? Even though, that doesn't explain my question what the difference between let lns = properties? . ( filler | domain )* and let lns = ( properties? . ( filler | domain )* )? is. Ciao, Xavier. From: Raphaël Pinson [mailto:raphael.pin...@camptocamp.com] Sent: Friday, February 12, 2016 11:00 AM To: Mol, Xavier (SCC) Cc: augeas-devel@redhat.com Subject: Re: [augeas-devel] Why does Augeas fail to handle empty files? On Fri, Feb 12, 2016 at 10:57 AM, Mol, Xavier (SCC) <xavier....@kit.edu> wrote: Hi again. > let lns = ( properties? . ( filler | domain )* )? One more note on this: After I have changed this line, augparse compains that a very complicated regular expression "matches the empty word", which actually is the point of the exercise. It shouldn't be. An empty file contains "\n", not "". Raphaël From: augeas-devel-boun...@redhat.com [mailto:augeas-devel-boun...@redhat.com] On Behalf Of Mol, Xavier (SCC) Sent: Friday, February 12, 2016 9:13 AM To: augeas-devel@redhat.com Subject: [augeas-devel] Why does Augeas fail to handle empty files? Hello Augeas experts, this issue was mentioned in a previous mail thread on this list (see attached final mail) and I've run into it again: Augeas seems to be quite strict about empty files (as opposed to non-existing files). I have a lens defined like this 'let lns = properties? . ( filler | domain )*'. The actual meaning of the sub-lenses is not important right now, since per regular expression this should successfully match the void. It indeed does create new files, but it fails to update empty files and this is the error message I get: """ [root ~]# >/etc/dcache/layouts/f01-151-109-e.conf [root ~]# augtool augtool> print /files/etc/dcache/layouts/f01-151-109-e.conf /files/etc/dcache/layouts/f01-151-109-e.conf augtool> set /files/etc/dcache/layouts/f01-151-109-e.conf/properties/dcache.java.memory.heap 2g augtool> print /files/etc/dcache/layouts/f01-151-109-e.conf /files/etc/dcache/layouts/f01-151-109-e.conf /files/etc/dcache/layouts/f01-151-109-e.conf/properties /files/etc/dcache/layouts/f01-151-109-e.conf/properties/dcache.java.memory.heap = "2g" augtool> save error: Failed to execute command saving failed (run 'errors' for details) augtool> errors Error in /etc/dcache/layouts/f01-151-109-e.conf (put_failed) Failed to match { /properties/ }? ( { /#comment/ = /[^\001-\004\t\n\r ][^\001-\004\n]*[^\001-\004\t\n\r ]|[^\001-\004\t\n\r ]/ } | { } | { /domain/ = /[$.0-9A-Z_a-{}-]+/ })* with tree { } { "properties" } Lens: /var/lib/puppet/lib/augeas/lenses/dcachelayout.aug:29.12-.46: """ For some reason, there is an empty node before the properties node, which failes the put direction. For that the lens needs to be written like… let lns = ( properties? . ( filler | domain )* )? As far as regular expressions go, there is no effective change here, right? Yet for Augeas this clearly seems to make a difference. Can someone maybe explain this to me? Thank you for your time, Xavier. **** 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 <tel:%2B49%20721%20608%2023041> Email: <mailto:xavier....@kit.edu> xavier....@kit.edu <http://www.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." **** _______________________________________________ augeas-devel mailing list augeas-devel@redhat.com https://www.redhat.com/mailman/listinfo/augeas-devel -- Raphaël Pinson Infrastructure Developer & Training Leader +33 458 482 013 Camptocamp France Savoie Technolac BP 352 48, avenue du Lac du Bourget 73372 Le Bourget du Lac, Cedex www.camptocamp.com
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ augeas-devel mailing list augeas-devel@redhat.com https://www.redhat.com/mailman/listinfo/augeas-devel