hercules-team / augeas

A configuration editing tool and API
http://augeas.net/
GNU Lesser General Public License v2.1
486 stars 199 forks source link

Properties lens doesn't like multi-line where first line has no value (1.0.0-5.el6_5.1) #110

Closed johnmccabe closed 10 years ago

johnmccabe commented 10 years ago

If you try to parse the following properties file.

tomcat.util.scan.DefaultJarScanner.jarsToSkip= \
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,\
catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar

it fails with the following error

augtool> set /augeas/load/Properties/lens Properties.lns
augtool> set /augeas/load/Properties/incl[last()+1] /tmp/test.properties
augtool> load
augtool> print /augeas//error
/augeas/files/tmp/test.properties/error = "parse_failed"
/augeas/files/tmp/test.properties/error/pos = "0"
/augeas/files/tmp/test.properties/error/line = "1"
/augeas/files/tmp/test.properties/error/char = "0"
/augeas/files/tmp/test.properties/error/lens = "/usr/share/augeas/lenses/dist/properties.aug:47.25-.100:"
/augeas/files/tmp/test.properties/error/message = "Iterated lens matched less than it should"

Changing the file to

tomcat.util.scan.DefaultJarScanner.jarsToSkip= bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,\
catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar

Works as expected

augtool> set /augeas/load/Properties/lens Properties.lns
augtool> set /augeas/load/Properties/incl[last()+1] /tmp/test.properties
augtool> load
augtool> print /files/tmp/test.properties/
/files/tmp/test.properties
/files/tmp/test.properties/tomcat.util.scan.DefaultJarScanner.jarsToSkip = " < multi > "
raphink commented 10 years ago

Hello,

This looks a lot like issue #19, which was fixed in 491df81021287ab4da53062a9226f0984481a7a9 and released as part of Augeas 1.2.0. Are you using a previous version of Augeas?

johnmccabe commented 10 years ago

Hi, Yes its 1.0.0-5 from the CentOS repos, I'll try it again with the 1.2.0.

johnmccabe commented 10 years ago

I've tried using the updated properties.aug with the 1.0.0-5.el6 version and it works as expected, thanks Raphaël

domcleal commented 10 years ago

Please file a bug on Red Hat's bugzilla if you'd like this to be addressed in the el6 version. Thanks.

gioppoluca commented 9 years ago

The 1.0.0-7.el6 version still has the same bug