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

expecting \"[Some('='), Some(':')]\" but found EOF #123

Open
pikhovkin opened this issue Mar 6, 2024 · 1 comment
Open

expecting \"[Some('='), Some(':')]\" but found EOF #123

pikhovkin opened this issue Mar 6, 2024 · 1 comment

Comments

@pikhovkin
Copy link

pikhovkin commented Mar 6, 2024

There is rust-ini==0.20.0 and a conf.ini

; conf.ini
[Book]
path=path/a/b
name=Some name
list=
    444
    555
    666

where last string is empty string.

I ran main.rs

use ini::Ini;

fn main() {
    let conf = Ini::load_from_file("./file.ini").unwrap();
    let section = conf.section(Some("Book")).unwrap();
    let path = section.get("path").unwrap();
    println!("{:?}: {:?}", section, path);
}

and got this err

thread 'main' panicked at src/main.rs:4:50:
called `Result::unwrap()` on an `Err` value: Parse(ParseError { line: 9, col: 1, msg: "expecting \"[Some('='), Some(':')]\" but found EOF." })
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1073:23
   4: rs_pull_repos::main
             at ./src/main.rs:4:16
   5: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Process finished with exit code 101

if I change conf.ini to

; file.ini
[Book]
path=path/a/b
name=Some name
list=
    444
    555
    666

where last string is 666.

The error will be

thread 'main' panicked at src/main.rs:4:50:
called `Result::unwrap()` on an `Err` value: Parse(ParseError { line: 8, col: 8, msg: "expecting \"[Some('='), Some(':')]\" but found EOF." })
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1073:23
   4: rs_pull_repos::main
             at ./src/main.rs:4:16
   5: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Process finished with exit code 101
@zonyitoo
Copy link
Owner

zonyitoo commented Mar 7, 2024

Multiline value is not supported by ini's standard.

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

No branches or pull requests

2 participants