Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-9163

Lexer incorrectly identifying list starts inside heredocs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.10.0, PUP 6.0.0
    • Fix Version/s: PUP 5.5.7, PUP 6.0.1
    • Component/s: None
    • Labels:
      None
    • Template:
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      When using interpolation inside a heredoc the position and location information for the interpolated expressions were wrong. This could lead to two problems;
      * if using {{[]}} expressions a mysterious Syntax Error would be raised if an
      seemingly arbitrary position after the interpolation contained white-space.
      * If there were errors in the interpolation they could end up being reported for the wrong line and position on the line.

      This is now fixed.
      Show
      When using interpolation inside a heredoc the position and location information for the interpolated expressions were wrong. This could lead to two problems; * if using {{[]}} expressions a mysterious Syntax Error would be raised if an seemingly arbitrary position after the interpolation contained white-space. * If there were errors in the interpolation they could end up being reported for the wrong line and position on the line. This is now fixed.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Square brackets that are:

      • Inside heredocs
      • Inside an interpolation

      Are sometimes being incorrectly lexed as TOKEN_LISTSTART.

      Simplest example

      Create test.pp:

      $xxxxxxx = @("END")
      ${facts['os']['family']}
      XXXXXXX XXX
      END
      notice($xxxxxxx)

      Puppet apply it.

      What I expect

      Some text to appear showing the OS family.

      What I actually see

      Error: Could not parse for environment production: Syntax error at '[' (file: /Users/alexharvey/git/home/puppet-test/test.pp, line: 2, column: 14)
      

      More info

      Note the space inside XXX XX. That space is matching in the lexer on this line here, leading to the '[' being lexed as TOKEN_LISTSTART.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  alexharv074 Alex Harvey
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: