augeas icon indicating copy to clipboard operation
augeas copied to clipboard

inifiles with trailing comments are broken

Open timurb opened this issue 10 years ago • 6 comments

This is a pullrequest with failing tests but not with functionality fix.

In version 0.10 empty comments after values in inifiles worked fine. After the upgrade the augeas started to crash with the following error on these:

$  augparse test_inifile.aug                                                                                          * master 1c89f56
test_inifile.aug:47.2-58.7:exception thrown in test
test_inifile.aug:47.7-.27:exception: Get did not match entire input
    Lens: /usr/share/augeas/lenses/dist/inifile.aug:497.25-.43:
    Error encountered at 8:0 (135 characters into string)
    <paces"\n; comment with colon\n|=|test_ace = value_with_traili>

    Tree generated so far:
    /#comment = "comment with sharp"
/(none)
/section1
/section1/test_ace[1] = "value"
/section1/test_ace[1]/#comment = "end of line comment"
/section1/test_ace[2]
/section1/test_ace[3] = "value with spaces"
/section1/#comment = "comment with colon"


Syntax error in lens definition
Failed to load test_inifile.aug

I'm using augeas-tools, augeas-lenses and libaugeas0 1.2.0-0ubuntu1 from Ubuntu 14.04

I'd happy to create not only a test for that but also a fix but atm I can't quite understand how to debug this into getting it fixed.

timurb avatar Jul 21 '14 09:07 timurb

The similar issue was observed before and fixed with: https://github.com/hercules-team/augeas/commit/5b289aa498c0c26ae46dc419050e36c8b20a2a91

After https://github.com/hercules-team/augeas/commit/49a267037705776813b3c3c9cefb31a659f9b71d it has broken again.

timurb avatar Jul 21 '14 12:07 timurb

End-of-line comments do work, but empty comments are not considered as comments.

raphink avatar Oct 22 '14 07:10 raphink

One option could be to use empty instead of eol at the end of entries.

raphink avatar Oct 22 '14 07:10 raphink

@timurb ping?

raphink avatar Jun 12 '15 10:06 raphink

@raphink Sorry, are you waiting for some input from me? This pull request is only failing tests. I could not fix this right away so I submitted only tests.

timurb avatar Jun 12 '15 12:06 timurb

Sorry, my bad, I reviewed the PR a bit too fast ;-)

raphink avatar Jun 12 '15 13:06 raphink