Skip to content

Syntax definitions #8

@dmke

Description

@dmke

Curently, go-uci is a "best effort" parser and does not strictly follow the rules imposed on UCI files.

This is mainly due to the fact, that the parser function in the original UCI C source does not declare the syntax in an obvious way (i.e. I could not find such a declaration).

In PR #7, I've accepted a change, which expands the accepted characters for identifiers from _a-zA-Z to -_a-zA-Z0-9. A valid UCI config file is /etc/config/wireless, which contains entries like

config wifi-device 'radio0'
	option type 'mac80211'
	...

Contrast this with this statement from the OpenWRT wiki on the file syntax (last paragraph in that section):

It is important to know that UCI identifiers and config file names may contain only the characters a-z, 0-9 and _. E.g. no hyphens (-) are allowed. Option values may contain any character (as long they are properly quoted).

The identifier wifi-device contains a hyphen, but does actually work and the uci binary accepts it without error.

It would be nice for the parser to be closer to uci/libuci and reject invalid identifiers (also the setter/getter methods should only accept valid identifiers).

A first step would be documenting the actually accepted file syntax, based on the C sources.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions