Page MenuHomeVyOS Platform

libvyosconfig does not allow comments after node
Closed, WontfixPublicBUG

Description

libvyosconfig fails to parse comments that are not before a node.

Example:

system {
    host-name vyos
    /* This causes "Parse error" */
}

Calling from_string() with this example returns a null pointer. Then get_error() returns "Parse error".

I downloaded libvyosconfig.so.0 from dev.packages.vyos.net/repositories/crux/vyos/pool/main/libv/libvyosconfig0/libvyosconfig0_0.0.8_amd64.deb.

Purposed solution:
Just like multiple comments before a node, these kind of comments can be ignored.

Details

Difficulty level
Easy (less than an hour)
Version
https://github.com/vyos/libvyosconfig/tree/9a80a5d3c652746f5e51d38aea1cf49f8a1949e4
Why the issue appeared?
Will be filled on close

Event Timeline

There are things that should be simply incorrect grammar, and this is one of them, as of me.

Are there any real-life situations when this can appear in the output of any VyOS scripts?

If you simply want to be able to include "normal" comments supposed to be ignored by the parser, that's a good idea, but they should not use the same syntax. I think it should be possible to extend the parser used by the loader to do that, for example, use "// ..." for non-significant comments.

dmbaturin claimed this task.

The use case for it will be addressed by the future support for true (ignored by the parser) comments.