~ubuntu-branches/ubuntu/precise/puppet/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/debian-changes

  • Committer: Package Import Robot
  • Author(s): Micah Anderson
  • Date: 2012-02-23 18:24:48 UTC
  • mfrom: (1.1.28) (3.1.36 sid)
  • Revision ID: package-import@ubuntu.com-20120223182448-belun93murza4w99
Tags: 2.7.11-1
* New upstream release
* Urgency set to high due to regressions in previous release
  and security vulnerabilities
* Execs when run with a user specified, but no group, get the root
  group. Similarly unexpected privileges are given to providers and
  types (egid remains as root), this is fixed with a patch from
  upstream (CVE-2012-1053)
* Fix Klogin write through symlink (CVE-2012-1054)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 information below has been extracted from the changelog. Adjust it or drop
6
6
 it.
7
7
 .
8
 
 puppet (2.7.10-1ubuntu1) precise; urgency=low
 
8
 puppet (2.7.11-1) unstable; urgency=high
9
9
 .
10
 
   * Use maintscript support in dh_installdeb rather than writing out
11
 
     dpkg-maintscript-helper commands by hand.  We now simply Pre-Depend on a
12
 
     new enough version of dpkg rather than using 'dpkg-maintscript-helper
13
 
     supports' guards, leading to more predictable behaviour on upgrades.
14
 
Author: Colin Watson <cjwatson@ubuntu.com>
 
10
   * New upstream release
 
11
   * Urgency set to high due to regressions in previous release
 
12
     and security vulnerabilities
 
13
   * Execs when run with a user specified, but no group, get the root
 
14
     group. Similarly unexpected privileges are given to providers and
 
15
     types (egid remains as root), this is fixed with a patch from
 
16
     upstream (CVE-2012-1053)
 
17
   * Fix Klogin write through symlink (CVE-2012-1054)
 
18
Author: Micah Anderson <micah@debian.org>
15
19
 
16
20
---
17
21
The information above should follow the Patch Tagging Guidelines, please
26
30
Reviewed-By: <name and email of someone who approved the patch>
27
31
Last-Update: <YYYY-MM-DD>
28
32
 
29
 
--- puppet-2.7.10.orig/Rakefile
30
 
+++ puppet-2.7.10/Rakefile
 
33
--- puppet-2.7.11.orig/Rakefile
 
34
+++ puppet-2.7.11/Rakefile
31
35
@@ -9,7 +9,7 @@ require 'rspec'
32
36
 require "rspec/core/rake_task"
33
37
 
37
41
 end
38
42
 
39
43
 Dir['tasks/**/*.rake'].each { |t| load t }
40
 
--- puppet-2.7.10.orig/test/lib/puppettest/fakes.rb
41
 
+++ puppet-2.7.10/test/lib/puppettest/fakes.rb
42
 
@@ -1,4 +1,4 @@
43
 
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/puppet/util'))
44
 
+require '/usr/lib/ruby/1.8/puppet/util'
45
 
 
46
 
 module PuppetTest
47
 
   # A baseclass for the faketypes.
48
 
--- puppet-2.7.10.orig/lib/puppet/provider/service/init.rb
49
 
+++ puppet-2.7.10/lib/puppet/provider/service/init.rb
 
44
--- puppet-2.7.11.orig/lib/puppet/provider/service/init.rb
 
45
+++ puppet-2.7.11/lib/puppet/provider/service/init.rb
50
46
@@ -129,7 +129,15 @@ Puppet::Type.type(:service).provide :ini
51
47
   # we just return that; otherwise, we return false, which causes it to
52
48
   # fallback to other mechanisms.
64
60
   end
65
61
 
66
62
 end
 
63
--- /dev/null
 
64
+++ puppet-2.7.11/lib/puppet/util/instrumentation/listeners/process_name.rb
 
65
@@ -0,0 +1,112 @@
 
66
+require 'monitor'
 
67
+
 
68
+# Unlike the other instrumentation plugins, this one doesn't give back
 
69
+# data. Instead it changes the process name of the currently running process
 
70
+# with the last labels and data. 
 
71
+Puppet::Util::Instrumentation.new_listener(:process_name) do
 
72
+  include Sync_m
 
73
+
 
74
+  # start scrolling when process name is longer than
 
75
+  SCROLL_LENGTH = 50
 
76
+
 
77
+  attr_accessor :active, :reason
 
78
+
 
79
+  def notify(label, event, data)
 
80
+    start(label) if event == :start
 
81
+    stop if event == :stop
 
82
+  end
 
83
+
 
84
+  def start(activity)
 
85
+    push_activity(Thread.current, activity)
 
86
+  end
 
87
+
 
88
+  def stop()
 
89
+    pop_activity(Thread.current)
 
90
+  end
 
91
+
 
92
+  def subscribed
 
93
+    synchronize do
 
94
+      @oldname = $0
 
95
+      @scroller ||= Thread.new do
 
96
+        loop do
 
97
+          scroll
 
98
+          sleep 1
 
99
+        end
 
100
+      end
 
101
+    end
 
102
+  end
 
103
+
 
104
+  def unsubscribed
 
105
+    synchronize do
 
106
+      $0 = @oldname if @oldname
 
107
+      Thread.kill(@scroller)
 
108
+      @scroller = nil
 
109
+    end
 
110
+  end
 
111
+
 
112
+  def setproctitle
 
113
+    $0 = "#{base}: " + rotate(process_name,@x)
 
114
+  end
 
115
+
 
116
+  def push_activity(thread, activity)
 
117
+    synchronize do
 
118
+      @reason ||= {}
 
119
+      @reason[thread] ||= []
 
120
+      @reason[thread].push(activity)
 
121
+      setproctitle
 
122
+    end
 
123
+  end
 
124
+
 
125
+  def pop_activity(thread)
 
126
+    synchronize do
 
127
+      @reason[thread].pop
 
128
+      if @reason[thread].empty?
 
129
+        @reason.delete(thread)
 
130
+      end
 
131
+      setproctitle
 
132
+    end
 
133
+  end
 
134
+
 
135
+  def process_name
 
136
+    out = (@reason || {}).inject([]) do |out, reason|
 
137
+      out << "#{thread_id(reason[0])} #{reason[1].join(',')}"
 
138
+    end
 
139
+    out.join(' | ')
 
140
+  end
 
141
+
 
142
+  # Getting the ruby thread id might not be portable to other ruby
 
143
+  # interpreters than MRI, because Thread#inspect might not return the same
 
144
+  # information on a different runtime.
 
145
+  def thread_id(thread)
 
146
+    thread.inspect.gsub(/^#<.*:0x([a-f0-9]+) .*>$/, '\1')
 
147
+  end
 
148
+
 
149
+  def rotate(string, steps)
 
150
+    steps ||= 0
 
151
+    if string.length > 0 && steps > 0
 
152
+      steps = steps % string.length
 
153
+      return string[steps..-1].concat " -- #{string[0..(steps-1)]}"
 
154
+    end
 
155
+    string
 
156
+  end
 
157
+
 
158
+  def base
 
159
+    basename = case Puppet.run_mode.name
 
160
+    when :master
 
161
+      "master"
 
162
+    when :agent
 
163
+      "agent"
 
164
+    else
 
165
+      "puppet"
 
166
+    end
 
167
+  end
 
168
+
 
169
+  def scroll
 
170
+    @x ||= 1
 
171
+    return if process_name.length < SCROLL_LENGTH
 
172
+    synchronize do
 
173
+      setproctitle
 
174
+      @x += 1
 
175
+    end
 
176
+  end
 
177
+end
 
178
\ No newline at end of file
 
179
--- puppet-2.7.11.orig/test/lib/puppettest/fakes.rb
 
180
+++ puppet-2.7.11/test/lib/puppettest/fakes.rb
 
181
@@ -1,4 +1,4 @@
 
182
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/puppet/util'))
 
183
+require '/usr/lib/ruby/1.8/puppet/util'
 
184
 
 
185
 module PuppetTest
 
186
   # A baseclass for the faketypes.
 
187
--- /dev/null
 
188
+++ puppet-2.7.11/spec/unit/util/instrumentation/listeners/process_name_spec.rb
 
189
@@ -0,0 +1,201 @@
 
190
+#!/usr/bin/env rspec
 
191
+require 'spec_helper'
 
192
+require 'puppet/util/instrumentation'
 
193
+
 
194
+Puppet::Util::Instrumentation.init
 
195
+process_name = Puppet::Util::Instrumentation.listener(:process_name)
 
196
+
 
197
+describe process_name do
 
198
+  before(:each) do
 
199
+    @process_name = process_name.new
 
200
+  end
 
201
+
 
202
+  it "should have a notify method" do
 
203
+    @process_name.should respond_to(:notify)
 
204
+  end
 
205
+
 
206
+  it "should not have a data method" do
 
207
+    @process_name.should_not respond_to(:data)
 
208
+  end
 
209
+
 
210
+  describe "when managing thread activity" do
 
211
+    before(:each) do
 
212
+      @process_name.stubs(:setproctitle)
 
213
+      @process_name.stubs(:base).returns("base")
 
214
+    end
 
215
+
 
216
+    it "should be able to append activity" do
 
217
+      thread1 = stub 'thread1'
 
218
+      @process_name.push_activity(:thread1,"activity1")
 
219
+      @process_name.push_activity(:thread1,"activity2")
 
220
+
 
221
+      @process_name.reason[:thread1].should == ["activity1", "activity2"]
 
222
+    end
 
223
+
 
224
+    it "should be able to remove activity" do
 
225
+      @process_name.push_activity(:thread1,"activity1")
 
226
+      @process_name.push_activity(:thread1,"activity1")
 
227
+      @process_name.pop_activity(:thread1)
 
228
+
 
229
+      @process_name.reason[:thread1].should == ["activity1"]
 
230
+    end
 
231
+
 
232
+    it "should maintain activity thread by thread" do
 
233
+      @process_name.push_activity(:thread1,"activity1")
 
234
+      @process_name.push_activity(:thread2,"activity2")
 
235
+
 
236
+      @process_name.reason[:thread1].should == ["activity1"]
 
237
+      @process_name.reason[:thread2].should == ["activity2"]
 
238
+    end
 
239
+
 
240
+    it "should set process title" do
 
241
+      @process_name.expects(:setproctitle)
 
242
+
 
243
+      @process_name.push_activity("thread1","activity1")
 
244
+    end
 
245
+  end
 
246
+
 
247
+  describe "when computing the current process name" do
 
248
+    before(:each) do
 
249
+      @process_name.stubs(:setproctitle)
 
250
+      @process_name.stubs(:base).returns("base")
 
251
+    end
 
252
+
 
253
+    it "should include every running thread activity" do
 
254
+      thread1 = stub 'thread1', :inspect => "\#<Thread:0xdeadbeef run>", :hash => 1
 
255
+      thread2 = stub 'thread2', :inspect => "\#<Thread:0x12344321 run>", :hash => 0
 
256
+
 
257
+      @process_name.push_activity(thread1,"Compiling node1.domain.com")
 
258
+      @process_name.push_activity(thread2,"Compiling node4.domain.com")
 
259
+      @process_name.push_activity(thread1,"Parsing file site.pp")
 
260
+      @process_name.push_activity(thread2,"Parsing file node.pp")
 
261
+
 
262
+      @process_name.process_name.should =~ /12344321 Compiling node4.domain.com,Parsing file node.pp/
 
263
+      @process_name.process_name.should =~ /deadbeef Compiling node1.domain.com,Parsing file site.pp/
 
264
+    end
 
265
+  end
 
266
+
 
267
+  describe "when finding base process name" do
 
268
+    {:master => "master", :agent => "agent", :user => "puppet"}.each do |program,base|
 
269
+      it "should return #{base} for #{program}" do
 
270
+        Puppet.run_mode.stubs(:name).returns(program)
 
271
+        @process_name.base.should == base
 
272
+      end
 
273
+    end
 
274
+  end
 
275
+
 
276
+  describe "when finding a thread id" do
 
277
+    it "should return the id from the thread inspect string" do
 
278
+      thread = stub 'thread', :inspect => "\#<Thread:0x1234abdc run>"
 
279
+      @process_name.thread_id(thread).should == "1234abdc"
 
280
+    end
 
281
+  end
 
282
+
 
283
+  describe "when scrolling the instrumentation string" do
 
284
+    it "should rotate the string of various step" do
 
285
+      @process_name.rotate("this is a rotation", 10).should == "rotation -- this is a "
 
286
+    end
 
287
+
 
288
+    it "should not rotate the string for the 0 offset" do
 
289
+      @process_name.rotate("this is a rotation", 0).should == "this is a rotation"
 
290
+    end
 
291
+  end
 
292
+
 
293
+  describe "when setting process name" do
 
294
+    before(:each) do
 
295
+      @process_name.stubs(:process_name).returns("12345 activity")
 
296
+      @process_name.stubs(:base).returns("base")
 
297
+      @oldname = $0
 
298
+    end
 
299
+
 
300
+    after(:each) do
 
301
+      $0 = @oldname
 
302
+    end
 
303
+
 
304
+    it "should do it if the feature is enabled" do
 
305
+      @process_name.setproctitle
 
306
+
 
307
+      $0.should == "base: 12345 activity"
 
308
+    end
 
309
+  end
 
310
+
 
311
+  describe "when subscribed" do
 
312
+    before(:each) do
 
313
+      thread = stub 'thread', :inspect => "\#<Thread:0x1234abdc run>"
 
314
+      Thread.stubs(:current).returns(thread)
 
315
+    end
 
316
+
 
317
+    it "should start the scroller" do
 
318
+      Thread.expects(:new)
 
319
+      @process_name.subscribed
 
320
+    end
 
321
+  end
 
322
+
 
323
+  describe "when unsubscribed" do
 
324
+    before(:each) do
 
325
+      @thread = stub 'scroller', :inspect => "\#<Thread:0x1234abdc run>"
 
326
+      Thread.stubs(:new).returns(@thread)
 
327
+      Thread.stubs(:kill)
 
328
+      @oldname = $0
 
329
+      @process_name.subscribed
 
330
+    end
 
331
+
 
332
+    after(:each) do
 
333
+      $0 = @oldname
 
334
+    end
 
335
+
 
336
+    it "should stop the scroller" do
 
337
+      Thread.expects(:kill).with(@thread)
 
338
+      @process_name.unsubscribed
 
339
+    end
 
340
+
 
341
+    it "should reset the process name" do
 
342
+      $0 = "let's see what happens"
 
343
+      @process_name.unsubscribed
 
344
+      $0.should == @oldname
 
345
+    end
 
346
+  end
 
347
+
 
348
+  describe "when setting a probe" do
 
349
+    before(:each) do
 
350
+      thread = stub 'thread', :inspect => "\#<Thread:0x1234abdc run>"
 
351
+      Thread.stubs(:current).returns(thread)
 
352
+      Thread.stubs(:new)
 
353
+      @process_name.active = true
 
354
+    end
 
355
+
 
356
+    it "should push current thread activity and execute the block" do
 
357
+      @process_name.notify(:instrumentation, :start, {})
 
358
+      $0.should == "puppet: 1234abdc instrumentation"
 
359
+      @process_name.notify(:instrumentation, :stop, {})
 
360
+    end
 
361
+
 
362
+    it "should finally pop the activity" do
 
363
+      @process_name.notify(:instrumentation, :start, {})
 
364
+      @process_name.notify(:instrumentation, :stop, {})
 
365
+      $0.should == "puppet: "
 
366
+    end
 
367
+  end
 
368
+
 
369
+  describe "when scrolling" do
 
370
+    it "should do nothing for shorter process names" do
 
371
+      @process_name.expects(:setproctitle).never
 
372
+      @process_name.scroll
 
373
+    end
 
374
+
 
375
+    it "should call setproctitle" do
 
376
+      @process_name.stubs(:process_name).returns("x" * 60)
 
377
+      @process_name.expects(:setproctitle)
 
378
+      @process_name.scroll
 
379
+    end
 
380
+
 
381
+    it "should increment rotation offset" do
 
382
+      name = "x" * 60
 
383
+      @process_name.stubs(:process_name).returns(name)
 
384
+      @process_name.expects(:rotate).once.with(name,1).returns("")
 
385
+      @process_name.expects(:rotate).once.with(name,2).returns("")
 
386
+      @process_name.scroll
 
387
+      @process_name.scroll
 
388
+    end
 
389
+  end
 
390
+end
 
391
\ No newline at end of file