Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toml lense fails to save files #715

Open
aobergschwandtner opened this issue Feb 17, 2021 · 4 comments
Open

Toml lense fails to save files #715

aobergschwandtner opened this issue Feb 17, 2021 · 4 comments
Labels

Comments

@aobergschwandtner
Copy link

I have a very easy toml file like

# This is a very easy TOML file

[node]
value = "foo"

The file can be parsed without any problem and also setting the value seems to work satisfying. But if I try to save the file saving fails with the following error detail:

Error in /var/tmp/easy.toml at node /files/var/tmp/easy.toml/ (put_failed)
  Failed to match tree under /

     { "#comment" = "This is a very easy TOML file" }
     {  }
     { "table" = "node" }

  with pattern
   (    { /entry/ = /[.0-9A-Z_a-z-]+/ }
      | { }
      | { /#comment/ = /[^\t\n\r ].*[^\t\n\r ]|[^\t\n\r ]/ })*
(    { /table/ = /[^]\n\r.]+(\\.[^]\n\r.]+)*/ }
      | { /@table/ = /[^]\n\r.]+(\\.[^]\n\r.]+)*/ })*

  Lens: /usr/share/augeas/lenses/dist/toml.aug:145.10-.45:

Modifying line 114 of toml.aug solves that issue, but after my modification it is not possible to parse more than two-dimensional arrays as rec_array is then not recursive anymore: let rec array_rec = array (norec | array_rec) -> let rec array_rec = array (norec | array_norec). Please find my easytoml.txt and augcmd.txt for reproducing the failure.

Thanks in advance.

@raphink raphink added the bug label Feb 23, 2021
@g0hl1n
Copy link
Contributor

g0hl1n commented Mar 30, 2021

I'm suffering the same issue.
Would it be acceptable to remove the recursive array for now as a "quick-fix" until somebody comes up with a valid solution?

@g0hl1n
Copy link
Contributor

g0hl1n commented Sep 7, 2021

Would it be acceptable to remove the recursive array for now as a "quick-fix" until somebody comes up with a valid solution?

ping 😃

georgehansper added a commit that referenced this issue May 6, 2022
* fix(lens): toml: add write support

The toml lens fails to save simple toml files due to problems with multi
dimensional (>2) arrays.
Therefore disable arrays with more than 2 dimensions for now to enable
basic usage again.

This commit fixes issue #715 by applying the suggested workaround. If
anyone can come up with a better solution please feel free to do so.

Fixes: 5e1cd31 (TOML lens (#91), 2018-11-29)
Signed-off-by: Richard Leitner <[email protected]>

* fix(lens): toml: update reference link

toml.io now provides a versioned reference URL, therefore use this
instead of the old GitHub repo link.

Signed-off-by: Richard Leitner <[email protected]>

* fix(lens): toml: typo in About: License

Signed-off-by: Richard Leitner <[email protected]>

* test(lens): toml: add basic write

This test covers the bug described in issue #715.

Signed-off-by: Richard Leitner <[email protected]>

* test(lens): toml: fix "array of arrays"

The "Test: Toml.array_norec; Array of arrays" tested a 3 dimensional
array. This commit fixes the test to actually test a 2 dimensional
array.

More than 2 dimensional arrays are currently not supported due to
issue #715.

Signed-off-by: Richard Leitner <[email protected]>

Co-authored-by: George Hansper <[email protected]>
@g0hl1n
Copy link
Contributor

g0hl1n commented May 9, 2022

This should be fixed by #742 now.

@Johnicholas-dd
Copy link

Thank you! This confused me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants