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

shellquote() function incorrectly escaping exclamation marks for bash argument usage

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 4.2.1
    • Fix Version/s: None
    • Component/s: Compiler
    • Labels:
    • Environment:

      ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] (Mac OSX Yosemite 10.10.5)
      Puppet v4.2.1

    • Template:
    • Team:
      Coremunity

      Description

      Using shellquote() to escape the output from template() of a file containing both single quotes and exclamation marks results in exclamation marks being improperly escaped (removing all single quotes results in correct escaping).

      Example using small sample xml file:

      irb(main):051:0> print scope.function_shellquote( \
        [scope.function_template(['test.xml'])])
      "<?xml version=\"1.0\"?>
      <\!-- \"License\"); -->
      <description> Using 'local.realm' to be </description>
      "=> nil
       
      bash-3.2$ echo "<?xml version=\"1.0\"?>
      > <\!-- \"License\"); -->
      > <description> Using 'local.realm' to be </description>
      > "
      <?xml version="1.0"?>
      <\!-- "License"); -->
      <description> Using 'local.realm' to be </description>
      

      When it should be returned as:

      bash-3.2$ echo "<?xml version=\"1.0\"?>
      <"\!"-- \"License\"); -->
      <description> Using 'local.realm' to be </description>
      "
      <?xml version="1.0"?>
      <!-- "License"); -->
      <description> Using 'local.realm' to be </description>
      

      (notice extra quotes surrounding escaped exclamation mark)

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            itsgrimetime Mike Grimes
            QA Contact:
            Sean Griffin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support