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

Parse error when importing toml files #2059

Closed
axyz opened this issue Oct 1, 2024 · 4 comments · Fixed by #2075
Closed

Parse error when importing toml files #2059

axyz opened this issue Oct 1, 2024 · 4 comments · Fixed by #2075
Labels
P1 critical: next release type: bug

Comments

@axyz
Copy link

axyz commented Oct 1, 2024

Describe the bug
toml files that use dot paths fail to parse.

error: toml parse error: TOML parse error at line 1, column 1
  |
1 | foo.bar = "qux"
  | ^^^^^^^^^^^^^^^
invalid type: string "bar", expected a borrowed string

on the other hand, when not using paths with simple top level keys (like in the example folder) e.g.

foo = "bar"

works correctly

even square bracket syntax seems to fail

[foo.bar]
qux = "42"

showing same error.

To Reproduce
try any of the simple previous examples in a minimal ncl file like

let _data = import "test.toml" in

{ data = _data }

Expected behavior
A clear and concise description of what you expected to happen.

Environment

Additional context
Add any other context about the problem here.

@yannham
Copy link
Member

yannham commented Oct 2, 2024

I suspect this is the addition of span information to TOML files which landed in 1.8.

@yannham
Copy link
Member

yannham commented Oct 2, 2024

Confirmed: this repro example doesn't fail in 1.7.0

@yannham yannham added P1 critical: next release type: bug labels Oct 2, 2024
@yannham
Copy link
Member

yannham commented Oct 2, 2024

After some investigation (albeit a bit shallow), I think it's a potential issue with toml-rs. Reported here toml-rs/toml#798.

In the meantime, @axyz : is building from source a possibility for you? In that case, you can checkout the 1.8.1-release branch and build Nickel with spanned-deser feature disabled in the following way:

$ cargo build --bin nickel --no-default-features --features "doc format repl" --release
[...]

And get a binary in ./target/release/nickel with span information for TOML disabled, which should work.

In any case, we might release a patch version where spanned deserialization is disabled by default, to fix the regression while the situation is sorted out.

@axyz
Copy link
Author

axyz commented Oct 2, 2024

@yannham yes, nothing urgent. I can use 1.7.0 or build a binary if needed, just wanted to report the issue.

Thanks for taking a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 critical: next release type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants