Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 puppet (2.7.11-1) unstable; urgency=high
 .
   * 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)
Author: Micah Anderson <micah@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- puppet-2.7.11.orig/Rakefile
+++ puppet-2.7.11/Rakefile
@@ -9,7 +9,7 @@ require 'rspec'
 require "rspec/core/rake_task"
 
 module Puppet
-    PUPPETVERSION = File.read('lib/puppet.rb')[/PUPPETVERSION *= *'(.*)'/,1] or fail "Couldn't find PUPPETVERSION"
+    PUPPETVERSION = File.read('/usr/lib/ruby/1.8/puppet.rb')[/PUPPETVERSION *= *'(.*)'/,1] or fail "Couldn't find PUPPETVERSION"
 end
 
 Dir['tasks/**/*.rake'].each { |t| load t }
--- puppet-2.7.11.orig/lib/puppet/provider/service/init.rb
+++ puppet-2.7.11/lib/puppet/provider/service/init.rb
@@ -129,7 +129,15 @@ Puppet::Type.type(:service).provide :ini
   # we just return that; otherwise, we return false, which causes it to
   # fallback to other mechanisms.
   def statuscmd
-    (@resource[:hasstatus] == :true) && [initscript, :status]
+      if @resource[:hasstatus] == :true then 
+          # Workaround the fact that initctl status command doesn't return
+          # proper exit codes. Can be removed once LP: #552786 is fixed.
+          if File.symlink?(initscript) && File.readlink(initscript) == "/lib/init/upstart-job" then
+              ['sh', '-c', "LANG=C invoke-rc.d #{File::basename(initscript)} status | grep -q '^#{File::basename(initscript)}.*running'" ]
+          else
+              [initscript, :status ]
+          end
+      end
   end
 
 end
--- /dev/null
+++ puppet-2.7.11/lib/puppet/util/instrumentation/listeners/process_name.rb
@@ -0,0 +1,112 @@
+require 'monitor'
+
+# Unlike the other instrumentation plugins, this one doesn't give back
+# data. Instead it changes the process name of the currently running process
+# with the last labels and data. 
+Puppet::Util::Instrumentation.new_listener(:process_name) do
+  include Sync_m
+
+  # start scrolling when process name is longer than
+  SCROLL_LENGTH = 50
+
+  attr_accessor :active, :reason
+
+  def notify(label, event, data)
+    start(label) if event == :start
+    stop if event == :stop
+  end
+
+  def start(activity)
+    push_activity(Thread.current, activity)
+  end
+
+  def stop()
+    pop_activity(Thread.current)
+  end
+
+  def subscribed
+    synchronize do
+      @oldname = $0
+      @scroller ||= Thread.new do
+        loop do
+          scroll
+          sleep 1
+        end
+      end
+    end
+  end
+
+  def unsubscribed
+    synchronize do
+      $0 = @oldname if @oldname
+      Thread.kill(@scroller)
+      @scroller = nil
+    end
+  end
+
+  def setproctitle
+    $0 = "#{base}: " + rotate(process_name,@x)
+  end
+
+  def push_activity(thread, activity)
+    synchronize do
+      @reason ||= {}
+      @reason[thread] ||= []
+      @reason[thread].push(activity)
+      setproctitle
+    end
+  end
+
+  def pop_activity(thread)
+    synchronize do
+      @reason[thread].pop
+      if @reason[thread].empty?
+        @reason.delete(thread)
+      end
+      setproctitle
+    end
+  end
+
+  def process_name
+    out = (@reason || {}).inject([]) do |out, reason|
+      out << "#{thread_id(reason[0])} #{reason[1].join(',')}"
+    end
+    out.join(' | ')
+  end
+
+  # Getting the ruby thread id might not be portable to other ruby
+  # interpreters than MRI, because Thread#inspect might not return the same
+  # information on a different runtime.
+  def thread_id(thread)
+    thread.inspect.gsub(/^#<.*:0x([a-f0-9]+) .*>$/, '\1')
+  end
+
+  def rotate(string, steps)
+    steps ||= 0
+    if string.length > 0 && steps > 0
+      steps = steps % string.length
+      return string[steps..-1].concat " -- #{string[0..(steps-1)]}"
+    end
+    string
+  end
+
+  def base
+    basename = case Puppet.run_mode.name
+    when :master
+      "master"
+    when :agent
+      "agent"
+    else
+      "puppet"
+    end
+  end
+
+  def scroll
+    @x ||= 1
+    return if process_name.length < SCROLL_LENGTH
+    synchronize do
+      setproctitle
+      @x += 1
+    end
+  end
+end
\ No newline at end of file
--- puppet-2.7.11.orig/test/lib/puppettest/fakes.rb
+++ puppet-2.7.11/test/lib/puppettest/fakes.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/puppet/util'))
+require '/usr/lib/ruby/1.8/puppet/util'
 
 module PuppetTest
   # A baseclass for the faketypes.
--- /dev/null
+++ puppet-2.7.11/spec/unit/util/instrumentation/listeners/process_name_spec.rb
@@ -0,0 +1,201 @@
+#!/usr/bin/env rspec
+require 'spec_helper'
+require 'puppet/util/instrumentation'
+
+Puppet::Util::Instrumentation.init
+process_name = Puppet::Util::Instrumentation.listener(:process_name)
+
+describe process_name do
+  before(:each) do
+    @process_name = process_name.new
+  end
+
+  it "should have a notify method" do
+    @process_name.should respond_to(:notify)
+  end
+
+  it "should not have a data method" do
+    @process_name.should_not respond_to(:data)
+  end
+
+  describe "when managing thread activity" do
+    before(:each) do
+      @process_name.stubs(:setproctitle)
+      @process_name.stubs(:base).returns("base")
+    end
+
+    it "should be able to append activity" do
+      thread1 = stub 'thread1'
+      @process_name.push_activity(:thread1,"activity1")
+      @process_name.push_activity(:thread1,"activity2")
+
+      @process_name.reason[:thread1].should == ["activity1", "activity2"]
+    end
+
+    it "should be able to remove activity" do
+      @process_name.push_activity(:thread1,"activity1")
+      @process_name.push_activity(:thread1,"activity1")
+      @process_name.pop_activity(:thread1)
+
+      @process_name.reason[:thread1].should == ["activity1"]
+    end
+
+    it "should maintain activity thread by thread" do
+      @process_name.push_activity(:thread1,"activity1")
+      @process_name.push_activity(:thread2,"activity2")
+
+      @process_name.reason[:thread1].should == ["activity1"]
+      @process_name.reason[:thread2].should == ["activity2"]
+    end
+
+    it "should set process title" do
+      @process_name.expects(:setproctitle)
+
+      @process_name.push_activity("thread1","activity1")
+    end
+  end
+
+  describe "when computing the current process name" do
+    before(:each) do
+      @process_name.stubs(:setproctitle)
+      @process_name.stubs(:base).returns("base")
+    end
+
+    it "should include every running thread activity" do
+      thread1 = stub 'thread1', :inspect => "\#<Thread:0xdeadbeef run>", :hash => 1
+      thread2 = stub 'thread2', :inspect => "\#<Thread:0x12344321 run>", :hash => 0
+
+      @process_name.push_activity(thread1,"Compiling node1.domain.com")
+      @process_name.push_activity(thread2,"Compiling node4.domain.com")
+      @process_name.push_activity(thread1,"Parsing file site.pp")
+      @process_name.push_activity(thread2,"Parsing file node.pp")
+
+      @process_name.process_name.should =~ /12344321 Compiling node4.domain.com,Parsing file node.pp/
+      @process_name.process_name.should =~ /deadbeef Compiling node1.domain.com,Parsing file site.pp/
+    end
+  end
+
+  describe "when finding base process name" do
+    {:master => "master", :agent => "agent", :user => "puppet"}.each do |program,base|
+      it "should return #{base} for #{program}" do
+        Puppet.run_mode.stubs(:name).returns(program)
+        @process_name.base.should == base
+      end
+    end
+  end
+
+  describe "when finding a thread id" do
+    it "should return the id from the thread inspect string" do
+      thread = stub 'thread', :inspect => "\#<Thread:0x1234abdc run>"
+      @process_name.thread_id(thread).should == "1234abdc"
+    end
+  end
+
+  describe "when scrolling the instrumentation string" do
+    it "should rotate the string of various step" do
+      @process_name.rotate("this is a rotation", 10).should == "rotation -- this is a "
+    end
+
+    it "should not rotate the string for the 0 offset" do
+      @process_name.rotate("this is a rotation", 0).should == "this is a rotation"
+    end
+  end
+
+  describe "when setting process name" do
+    before(:each) do
+      @process_name.stubs(:process_name).returns("12345 activity")
+      @process_name.stubs(:base).returns("base")
+      @oldname = $0
+    end
+
+    after(:each) do
+      $0 = @oldname
+    end
+
+    it "should do it if the feature is enabled" do
+      @process_name.setproctitle
+
+      $0.should == "base: 12345 activity"
+    end
+  end
+
+  describe "when subscribed" do
+    before(:each) do
+      thread = stub 'thread', :inspect => "\#<Thread:0x1234abdc run>"
+      Thread.stubs(:current).returns(thread)
+    end
+
+    it "should start the scroller" do
+      Thread.expects(:new)
+      @process_name.subscribed
+    end
+  end
+
+  describe "when unsubscribed" do
+    before(:each) do
+      @thread = stub 'scroller', :inspect => "\#<Thread:0x1234abdc run>"
+      Thread.stubs(:new).returns(@thread)
+      Thread.stubs(:kill)
+      @oldname = $0
+      @process_name.subscribed
+    end
+
+    after(:each) do
+      $0 = @oldname
+    end
+
+    it "should stop the scroller" do
+      Thread.expects(:kill).with(@thread)
+      @process_name.unsubscribed
+    end
+
+    it "should reset the process name" do
+      $0 = "let's see what happens"
+      @process_name.unsubscribed
+      $0.should == @oldname
+    end
+  end
+
+  describe "when setting a probe" do
+    before(:each) do
+      thread = stub 'thread', :inspect => "\#<Thread:0x1234abdc run>"
+      Thread.stubs(:current).returns(thread)
+      Thread.stubs(:new)
+      @process_name.active = true
+    end
+
+    it "should push current thread activity and execute the block" do
+      @process_name.notify(:instrumentation, :start, {})
+      $0.should == "puppet: 1234abdc instrumentation"
+      @process_name.notify(:instrumentation, :stop, {})
+    end
+
+    it "should finally pop the activity" do
+      @process_name.notify(:instrumentation, :start, {})
+      @process_name.notify(:instrumentation, :stop, {})
+      $0.should == "puppet: "
+    end
+  end
+
+  describe "when scrolling" do
+    it "should do nothing for shorter process names" do
+      @process_name.expects(:setproctitle).never
+      @process_name.scroll
+    end
+
+    it "should call setproctitle" do
+      @process_name.stubs(:process_name).returns("x" * 60)
+      @process_name.expects(:setproctitle)
+      @process_name.scroll
+    end
+
+    it "should increment rotation offset" do
+      name = "x" * 60
+      @process_name.stubs(:process_name).returns(name)
+      @process_name.expects(:rotate).once.with(name,1).returns("")
+      @process_name.expects(:rotate).once.with(name,2).returns("")
+      @process_name.scroll
+      @process_name.scroll
+    end
+  end
+end
\ No newline at end of file
