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

allow quotes to accept special characters in cmdline values #426

Closed
wants to merge 1 commit into from

Conversation

anibalportero
Copy link
Contributor

@anibalportero anibalportero commented May 17, 2024

This PR contains a modification of the cmdline parser to support quoted configuration arguments.

Syntax rules have been kept as similar as the Linux Kernel cmdline as possible:

  • Any number of spaces between items is allowed.
  • The ' ' special character is used as a separator between items.
  • The '"' special character is used to escape separators, using two between each config item or between the value.
  • The '"' between items, and values are discarded after parsing the cmdline.
  • The '=' special character cannot be escaped.
  • The first '=' found separates the key and the value of an item, while the rest of '=' are part of the value.
  • Empty keys are not allowed.

While keeping Pantavisor special rules for backwards compatibility with the current configuration syntax:

  • Items without '=' are ignored.
  • The '\n' special character is used as an equivalent to the ' ' separator.
  • Items need to have a prefix ("pv_" or "ph_") to be acknowledged by Pantavisor.
  • Empty values are allowed and substituted by an empty string.
  • The processed keys depend on the set of Pantavisor configuration keys.

@anibalportero anibalportero force-pushed the feature/quote_cmdline branch 2 times, most recently from f3f9d13 to 4da68b2 Compare May 21, 2024 14:13
@anibalportero anibalportero marked this pull request as draft May 21, 2024 14:22
@anibalportero anibalportero marked this pull request as ready for review May 22, 2024 14:32
@fortizc
Copy link
Collaborator

fortizc commented May 22, 2024

LGTM 👍🏼

@asac
Copy link
Contributor

asac commented May 22, 2024

where does our parser differ from what the kernel parses from cmdline to ENV? the closer we are to that behaviour the better we are prepared to later move to envs from this approach.

@anibalportero anibalportero force-pushed the feature/quote_cmdline branch 2 times, most recently from cc35d3a to e926569 Compare May 23, 2024 04:59
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

Successfully merging this pull request may close these issues.

None yet

3 participants