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

Incorrect handling of escape sequence precedence

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.9.0
    • Component/s: Language
    • Labels:
    • Template:
    • Acceptance Criteria:
      Hide

      It should be possible to escape a unicode character specification in a string using both short and long form.

      Show
      It should be possible to escape a unicode character specification in a string using both short and long form.
    • Epic Link:
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      PDS 2016-11-30
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      It was not possible to escape a unicode character. The result of
      {code}
      "\\uFFFF"
      {code}
      Ended up being a literal backslash followed by the uFFFF character.
      Show
      It was not possible to escape a unicode character. The result of {code} "\\uFFFF" {code} Ended up being a literal backslash followed by the uFFFF character.
    • QA Risk Assessment:
      Manual
    • QA Risk Assessment Reason:
      functional review in comments. covered well by unit tests.

      Description

      Since Puppet 4 one can use Unicode escape sequences, which work fine:

      $ puppet apply -e 'notify { "\uFFFF": }'
      Notice: Compiled catalog for example.com in environment production in 0.11 seconds
      Notice: ￿
      Notice: /Stage[main]/Main/Notify[￿]/message: defined 'message' as '￿'
      Notice: Applied catalog in 0.10 seconds
      

      However, if I now want to escape the unicode escape sequence by doubling the backslash and print the literal string \uFFFF it seems like Puppet applies the \u escape before the double backslash escape:

      $ puppet apply -e 'notify { "\\uFFFF": }'
      Warning: Unrecognized escape sequence '\￿'  at line 1:21
      Notice: Compiled catalog for example.com in environment production in 0.13 seconds
      Notice: \￿
      Notice: /Stage[main]/Main/Notify[\￿]/message: defined 'message' as '\￿'
      Notice: Applied catalog in 0.10 seconds
      

      I think this is the wrong way around, and certainly not what one would expect from other languages.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              arnoutboks Arnout Boks
              QA Contact:
              Eric Thompson
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support