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

Misleading error message from cfg_parse #116

Open
eplanet opened this issue Nov 10, 2018 · 9 comments
Open

Misleading error message from cfg_parse #116

eplanet opened this issue Nov 10, 2018 · 9 comments

Comments

@eplanet
Copy link

eplanet commented Nov 10, 2018

Hello! I'm following i3status #249 bug. It seems that if we miss a closing quote in the following configuration:

order += "disk /home
order += "wireless wlan0"

wireless wlan0 {
        format_up = "W: (%quality at %essid, %bitrate) %ip"
        format_down = "W: down"
}
disk "/home" {
        format = "%free"
}

The displayed error isn't correct: missing opening brace for section 'wireless'.

It seems there's little we can do on our end, so do you think this could be improved here?

Thanks!

@troglobit
Copy link
Collaborator

Possibly, but not easily. The string quotes enables multi-line input, so it's not until a left brace is found that a possible syntax error is detected. I guess we could add some flag so we could use end-of-line or end qoute to close a string. What do you think?

@eplanet
Copy link
Author

eplanet commented Nov 15, 2018

In our case I think we'd prefer a flag that forbids new lines for strings, as we should never do that in our configuration file. That being said, I don't know what libconfuse users usually do, so either are good to me if you think your option is better suited.

By the way, it's the right brace that triggers the parsing error, the left being parsed within a string from what you say. So it's kind of weird that the parser doesn't realize it's all very weird tokens until then?

@Airblader
Copy link

If it's multi-line string input you couldn't detect a syntax error until the first character after the next quote at the earliest (which may well be EOF), since braces in strings have to be allowed, right?

I agree that a flag to disable multi-line strings would be useful to us, if possible.

@troglobit
Copy link
Collaborator

@Airblader +1

Yeah, a do-what-I-mean flag would be highly useful. Not sure when I'll have the time to implement it though. Any takers for a PR?

@eplanet
Copy link
Author

eplanet commented Nov 15, 2018

I might give it a try, unless experienced libconfuse dev wants to grab it.

@troglobit
Copy link
Collaborator

@eplanet Go ahead, and please feel free to ask questions about the tokenizer or parser in this thread.

@eplanet eplanet changed the title Misleading error message from cfg_prase Misleading error message from cfg_parse Nov 22, 2018
@troglobit
Copy link
Collaborator

@eplanet How did it go?

@eplanet
Copy link
Author

eplanet commented Mar 23, 2019

Thanks for following up! I'm very sorry, I gave it a try two times but didn't manage to focus enough to make something worth it. If you want to take over you're very welcome.

@troglobit
Copy link
Collaborator

@eplanet No worries, just following up on things. We'll leave the issue open then, maybe someone else picks it up.

... if you do, post here please :)

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

3 participants