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

literal_parser.rb: fix scan_embeded_code #564

Merged
merged 1 commit into from
Mar 27, 2015
Merged

Conversation

sonots
Copy link
Member

@sonots sonots commented Mar 23, 2015

Writing conf like:

<source>
  type dummy
  tag "#{ENV['HOGE']}foo#{ENV['MOGE']}"
</source>

results in a error:

/home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/literal_parser.rb:157:in `instance_eval': (eval):1: syntax error, unexpected tSTRING_DEND, expecting end-of-input (SyntaxError)
ENV['HOGE']}foo#{ENV['MOGE']
            ^
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/literal_parser.rb:157:in `eval_embedded_code'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/literal_parser.rb:84:in `scan_double_quoted_string'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/literal_parser.rb:68:in `scan_string'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/literal_parser.rb:61:in `parse_literal'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/v1_parser.rb:128:in `parse_element'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/v1_parser.rb:93:in `parse_element'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/v1_parser.rb:41:in `parse!'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config/v1_parser.rb:31:in `parse'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/config.rb:29:in `parse'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/supervisor.rb:356:in `read_config'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/supervisor.rb:126:in `start'
        from /home/sonots/src/github.com/fluent/fluentd/lib/fluent/command/fluentd.rb:167:in `<top (required)>'
        from /home/sonots/src/github.com/fluent/fluentd/bin/fluentd:6:in `require'
        from /home/sonots/src/github.com/fluent/fluentd/bin/fluentd:6:in `<top (required)>'
        from /home/sonots/.rbenv/versions/haikanko/lib/ruby/gems/2.1.0/bin/fluentd:23:in `load'
        from /home/sonots/.rbenv/versions/haikanko/lib/ruby/gems/2.1.0/bin/fluentd:23:in `<main>'

This patch fixes this issue.

@@ -147,7 +147,7 @@ def scan_embedded_code

@ss.pos += code.length

code
'"#{' + code + '}"'
Copy link
Member Author

Choose a reason for hiding this comment

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

In previous code, we get code as ENV['HOGE'] for "#{ENV['HOGE']}foo", which is okay.
But, we get code as ENV['HOGE']}foo#{ENV['MOGE'] for "#{ENV['HOGE']}foo#{ENV['MOGE']}", whish is bad.

repeatedly added a commit that referenced this pull request Mar 27, 2015
literal_parser.rb: fix scan_embeded_code
@repeatedly repeatedly merged commit c6be216 into master Mar 27, 2015
@repeatedly repeatedly deleted the fix_scan_embeded_code branch March 27, 2015 09:51
repeatedly added a commit that referenced this pull request Apr 19, 2015
literal_parser.rb: fix scan_embeded_code
@sonots
Copy link
Member Author

sonots commented Apr 19, 2015

cherry-picked to v0.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants