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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Done
    • PUP 3.7.5, PUP 4.0.0
    • PUP 3.8.1, PUP 4.1.0
    • Docs, Language
    • None
    • 1
    • Language 2015-04-29, Language 2015-05-13
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support