puppet 4.10.7 → 4.10.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

@@ -133,7 +133,7 @@ module HeredocSupport
133
133
  lines = lines.collect {|s| s.gsub(leading_pattern, '') }
134
134
  end
135
135
  result = lines.join('')
136
- result.gsub!(/\r?\n$/, '') if remove_break
136
+ result.gsub!(/\r?\n\z/m, '') if remove_break
137
137
  result
138
138
  end
139
139
 
@@ -48,7 +48,8 @@ module Puppet::Pops::Patterns
48
48
 
49
49
  # VAR_NAME matches the name part of a variable (The $ character is not included)
50
50
  # Note, that only the final segment may start with an underscore.
51
- VAR_NAME = %r{\A(?:((::)?[a-z]\w*)*(?:(::)?_\w*)?)\z}
51
+ # Note, regexp sensitive to backtracking
52
+ VAR_NAME = %r{\A(?:::)?(?:[a-z]\w*::)*[a-z_]\w*\z}
52
53
 
53
54
  # PARAM_NAME matches the name part of a parameter (The $ character is not included)
54
55
  PARAM_NAME = %r{\A[a-z_]\w*\z}
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
 
8
8
  module Puppet
9
- PUPPETVERSION = '4.10.7'
9
+ PUPPETVERSION = '4.10.8'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and
@@ -18,8 +18,13 @@ describe "the epp function" do
18
18
  end
19
19
 
20
20
  it "gets error accessing a variable that is malformed" do
21
- expect { eval_template("<%= $kryptonite::USER %>")}.to raise_error(
22
- /Illegal variable name, The given name 'kryptonite::USER' does not conform to the naming rule/)
21
+ expect { eval_template("<%= $kryptonite::bbbbbbbbbbbb::cccccccc::ddd::USER %>")}.to raise_error(
22
+ /Illegal variable name, The given name 'kryptonite::bbbbbbbbbbbb::cccccccc::ddd::USER' does not conform to the naming rule/)
23
+ end
24
+
25
+ it "gets error accessing a variable that is malformed as reported in PUP-7848" do
26
+ expect { eval_template("USER='<%= $hg_oais::archivematica::requirements::automation_tools::USER %>'")}.to raise_error(
27
+ /Illegal variable name, The given name 'hg_oais::archivematica::requirements::automation_tools::USER' does not conform to the naming rule/)
23
28
  end
24
29
 
25
30
  it "get nil accessing a variable that is undef" do
@@ -473,6 +473,36 @@ describe 'Lexer2' do
473
473
  )
474
474
  end
475
475
 
476
+ it 'strips only last newline when using trim option' do
477
+ code = <<-CODE.unindent
478
+ @(END)
479
+ Line 1
480
+
481
+ Line 2
482
+ -END
483
+ CODE
484
+ expect(tokens_scanned_from(code)).to match_tokens2(
485
+ [:HEREDOC, ''],
486
+ [:SUBLOCATE, ["Line 1\n", "\n", "Line 2\n"]],
487
+ [:STRING, "Line 1\n\nLine 2"],
488
+ )
489
+ end
490
+
491
+ it 'strips only one newline at the end when using trim option' do
492
+ code = <<-CODE.unindent
493
+ @(END)
494
+ Line 1
495
+ Line 2
496
+
497
+ -END
498
+ CODE
499
+ expect(tokens_scanned_from(code)).to match_tokens2(
500
+ [:HEREDOC, ''],
501
+ [:SUBLOCATE, ["Line 1\n", "Line 2\n", "\n"]],
502
+ [:STRING, "Line 1\nLine 2\n"],
503
+ )
504
+ end
505
+
476
506
  context 'with bad syntax' do
477
507
  def expect_issue(code, issue)
478
508
  expect { tokens_scanned_from(code) }.to raise_error(Puppet::ParseErrorWithIssue) { |e|
@@ -625,6 +625,16 @@ describe "validating 4x" do
625
625
  end
626
626
  end
627
627
 
628
+ context 'uses a var pattern that is performant' do
629
+ it 'such that illegal VAR_NAME is not too slow' do
630
+ t = Time.now.nsec
631
+ result = '$hg_oais::archivematica::requirements::automation_tools::USER' =~ Puppet::Pops::Patterns::VAR_NAME
632
+ t2 = Time.now.nsec
633
+ expect(result).to be(nil)
634
+ expect(t2-t).to be < 1000000 # one ms as a check for very slow operation, is in fact at ~< 10 microsecond
635
+ end
636
+ end
637
+
628
638
  def parse(source)
629
639
  Puppet::Pops::Parser::Parser.new().parse_string(source)
630
640
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.7
4
+ version: 4.10.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-06 00:00:00.000000000 Z
12
+ date: 2017-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: facter