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

fix(config): Fix comment removal in TOML files #14240

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Nov 2, 2023

resolves #14237

The current code for removing comments from TOML files is not aware of multi-line strings. As a consequence, hashes embedded in multi-line strings (as shown in #14237) will be considered a comment and all text until the end-line is removed.

This PR completely reworks the parsing by implementing a state machine matching the start and end of comments, strings, multi-line strings and handles escaping. It also adds a test case including (but not limited to) #14237.

@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Nov 2, 2023

@srebhan srebhan added area/configuration ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Nov 2, 2023
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for digging into this so quickly!

@powersj powersj merged commit 1887d29 into influxdata:master Nov 6, 2023
4 checks passed
@github-actions github-actions bot added this to the v1.28.4 milestone Nov 6, 2023
Hipska added a commit to Super-Visions/telegraf that referenced this pull request Nov 7, 2023
* master:
  fix(inputs.win_perf_counter): Do not rely on returned buffer size (influxdata#14241)
  feat(inputs.modbus): Add support for string-fields (influxdata#14145)
  chore(deps): Bump cloud.google.com/go/storage from 1.30.1 to 1.34.1 (influxdata#14253)
  chore(deps): Bump github.com/rabbitmq/amqp091-go from 1.8.1 to 1.9.0 (influxdata#14252)
  chore(deps): Bump github.com/hashicorp/consul/api from 1.25.1 to 1.26.1 (influxdata#14251)
  chore(deps): Bump github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs from 1.23.5 to 1.26.0 (influxdata#14249)
  fix(config): Fix comment removal in TOML files (influxdata#14240)
  feat(outputs.prometheus_client): Support listen on vsock (influxdata#14108)
  fix(inputs.mqtt_consumer): Resolve could not mark message delivered (influxdata#14243)
  chore(linters): Fix findings found by testifylint for Windows and enable it. (influxdata#14238)
  feat(migrations): Add option migration for inputs.nats_consumer (influxdata#14234)
  feat(migrations): Add option migration for inputs.mqtt_consumer (influxdata#14233)
  test(inputs.jolokia2_agent): Sort metrics as order is not consistent (influxdata#14227)
powersj pushed a commit that referenced this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config - Cannot use hash (#) inside of inner single quotes within multi-line literal string
2 participants