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

Single backslash before $ blocks interpolation in heredoc with no escapes enabled

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: PUP 3.7.5, PUP 4.0.0
    • Fix Version/s: PUP 3.8.1, PUP 4.1.0
    • Component/s: Docs, Language
    • Labels:
      None
    • Template:
    • Epic Link:
    • Story Points:
      1
    • Sprint:
      Language 2015-04-29, Language 2015-05-13
    • Release Notes:
      Bug Fix

      Description

      Ran:

      $thing = "hi there"
      notice(@("END INTERP"))
      This string should be able to interpolate variables, and all backslashes should
      be interpreted as plain old literal backslashes.
      Variable standing apart: ${thing}
      Variable enjambed: hey${thing}
      Variable with single backslash enjambed: \${thing}
      Variable with double backslash enjambed: \\${thing}
      END INTERP
      

      The single backslash before the $ causes a problem. I'm pretty sure this is against the specification of heredocs.

      Actual result:

      Notice: Scope(Class[main]): This string should be able to interpolate variables, and all backslashes should
      be interpreted as plain old literal backslashes.
      Variable standing apart: hi there
      Variable enjambed: heyhi there
      Variable with single backslash enjambed: \${thing}
      Variable with double backslash enjambed: \\hi there
      
      

      Expected result:

      Notice: Scope(Class[main]): This string should be able to interpolate variables, and all backslashes should
      be interpreted as plain old literal backslashes.
      Variable standing apart: hi there
      Variable enjambed: heyhi there
      Variable with single backslash enjambed: \hi there
      Variable with double backslash enjambed: \\hi there
      
      

      3.7.5 and 4.0.0 behave identically.

      In addition, if any escape (other than '$' escapes) are turned on, it also turns on escaping of '$'. This is caused by the same faulty logic.

      QA


      risk: medium (validate only)
      probability: low (single backslash directly before interpolation in pp heredoc)
      severity: medium (obvious issue, workarounds)
      test level: unit

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            nick.fagerlund Nicholas Fagerlund
            QA Contact:
            Eric Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support