The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Bug #6723

Puppet::Util::Execution withenv method not resetting environment

Added by Anonymous about 5 years ago. Updated about 5 years ago.

Status:ClosedStart date:03/15/2011
Priority:NormalDue date:
Assignee:-% Done:


Target version:2.6.7
Affected Puppet version: Branch:

We've Moved!

Ticket tracking is now hosted in JIRA:


The withenv method in lib/puppet/util/execution is supposed to reset the environment to the state it was in before it was called, but it appears that it may not be doing this. A spec test written using this method was able to pollute the environment’s PATH variable for all of the tests that ran after it. As is, there are no tests for this method. Tests should be added to check its behavior, and if it isn’t correctly resetting the environment, it should be changed so that it does. Below is the test that caused the change to PATH:

it "should warn if you're overriding path in environment" do    
     @provider.resource[:path] = ['/bogus/bin']
     @provider.resource[:environment] = ['PATH=/something/else']


       Puppet::Util.expects(:execute).with(['foo'], {:uid => nil, :gid => nil, :combine => true, :failonfail => false})"foo") {|l| "#{l.level}: #{l.message}" }.should == ["warning: Overriding environment setting 'PATH' with '/something/else'"]

Related issues

Related to Puppet - Feature #4884: An exec provider that executes unfiltered bash code. Closed 09/30/2010
Related to Puppet - Bug #17603: Puppet execute has unexpected semantics Accepted


#1 Updated by Anonymous about 5 years ago

  • Category set to exec
  • Status changed from Unreviewed to Accepted

#2 Updated by Anonymous about 5 years ago

  • Status changed from Accepted to Merged - Pending Release

Reviewed with Matt Robinson & Daniel Pittman, pushed to in commit:4c9bd43bc2f5fde9d86196e8689dced929d39aad

#3 Updated by James Turnbull about 5 years ago

  • Status changed from Merged - Pending Release to Closed
  • Target version set to 2.6.7

Also available in: Atom PDF