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

control warning for unrecognized escapes in dq strings with --strict

    Details

    • Type: Improvement
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 4.7.0
    • Fix Version/s: PUP 5.y
    • Component/s: Language
    • Labels:
      None
    • Environment:

      puppet 4.7.0
      ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

    • Template:
    • Acceptance Criteria:
      Hide

      see expected behaviour in the description

      Show
      see expected behaviour in the description
    • Epic Link:
    • Team:
      Server
    • Story Points:
      1

      Description

      Observe:

      $ cat ~/tmp/notice.pp
      notice('1 bs: \1')
      notice('2 bs: \\1')
      notice('3 bs: \\\1')
      notice('4 bs: \\\\1')
       
      $ bundle exec puppet apply ~/tmp/notice.pp
      Notice: Scope(Class[main]): 1 bs: \1
      Notice: Scope(Class[main]): 2 bs: \1
      Notice: Scope(Class[main]): 3 bs: \\1
      Notice: Scope(Class[main]): 4 bs: \\1
      Notice: Compiled catalog for davids.corp.puppetlabs.net in environment production in 0.07 seconds
      Notice: Applied catalog in 0.03 seconds
      $ vi ~/tmp/notice.pp
      $ cat ~/tmp/notice.pp
      notice("1 bs: \1")
      notice("2 bs: \\1")
      notice("3 bs: \\\1")
      notice("4 bs: \\\\1")
      $ bundle exec puppet apply ~/tmp/notice.pp
      Warning: Unrecognized escape sequence '\1' at /home/david/tmp/notice.pp:1:18
      Warning: Unrecognized escape sequence '\1' at /home/david/tmp/notice.pp:3:20
      Notice: Scope(Class[main]): 1 bs: \1
      Notice: Scope(Class[main]): 2 bs: \1
      Notice: Scope(Class[main]): 3 bs: \\1
      Notice: Scope(Class[main]): 4 bs: \\1
      Notice: Compiled catalog for davids.corp.puppetlabs.net in environment production in 0.06 seconds
      Notice: Applied catalog in 0.03 seconds
      $ bundle exec puppet apply ~/tmp/notice.pp --strict=error
      Warning: Unrecognized escape sequence '\1' at /home/david/tmp/notice.pp:1:18
      Warning: Unrecognized escape sequence '\1' at /home/david/tmp/notice.pp:3:20
      Notice: Scope(Class[main]): 1 bs: \1
      Notice: Scope(Class[main]): 2 bs: \1
      Notice: Scope(Class[main]): 3 bs: \\1
      Notice: Scope(Class[main]): 4 bs: \\1
      Notice: Compiled catalog for davids.corp.puppetlabs.net in environment production in 0.08 seconds
      Notice: Applied catalog in 0.03 seconds
      $ bundle exec puppet apply ~/tmp/notice.pp --strict=off
      Warning: Unrecognized escape sequence '\1' at /home/david/tmp/notice.pp:1:18
      Warning: Unrecognized escape sequence '\1' at /home/david/tmp/notice.pp:3:20
      Notice: Scope(Class[main]): 1 bs: \1
      Notice: Scope(Class[main]): 2 bs: \1
      Notice: Scope(Class[main]): 3 bs: \\1
      Notice: Scope(Class[main]): 4 bs: \\1
      Notice: Compiled catalog for davids.corp.puppetlabs.net in environment production in 0.06 seconds
      Notice: Applied catalog in 0.03 seconds
      $ 
      

      This behaviour is confusing and dangerous. See PUP-6709 and DOCUMENT-586 for some fall out from this.

      Expected behaviour:
      • unrecognized escape sequences are treated the same in single and double quoted strings (observing that the set of unrecognized chars are different)
      • the warning for unrecognized escape sequences in double quoted strings should be controllable by --strict
        Unless --strict=off is set, unrecognized escape sequences should be recognized and reported to the user.
      • single quoted strings do not warn/error for unescaped character sequences due to massive reporting for windows style paths

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  david.schmitt David Schmitt
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated: