Bug #14964

Puppet fails to unlink stdout tempfile if child process is launched asynchronously

Added by Josh Cooper about 1 year ago. Updated 10 months ago.

Status:ClosedStart date:06/11/2012
Priority:NormalDue date:
Assignee:Josh Cooper% Done:

0%

Category:windows
Target version:2.7.19
Affected Puppet version:2.7.6 Branch:https://github.com/puppetlabs/puppet/pull/927
Keywords:windows exec start

Description

Executing the following generates an error because the notepad.exe process inherits a copy of the stdout tempfile handle, preventing puppet from being able to unlink it:

c:/work/puppet> envpuppet puppet apply -e "exec { 'cmd.exe /c start notepad.exe': path => $path }" --trace
c:/puppetwinbuilder/sys/ruby/lib/ruby/1.8/tempfile.rb:170:in `unlink'
c:/puppetwinbuilder/sys/ruby/lib/ruby/1.8/tempfile.rb:170:in `callback'
c:/puppetwinbuilder/sys/ruby/lib/ruby/1.8/tempfile.rb:119:in `call'
c:/puppetwinbuilder/sys/ruby/lib/ruby/1.8/tempfile.rb:119:in `close!'
c:/puppetwinbuilder/sys/ruby/lib/ruby/1.8/tempfile.rb:110:in `close'
c:/work/puppet/ext/../lib/puppet/util.rb:425:in `wait_for_output'
c:/work/puppet/ext/../lib/puppet/util.rb:418:in `times'
c:/work/puppet/ext/../lib/puppet/util.rb:418:in `wait_for_output'
c:/work/puppet/ext/../lib/puppet/util.rb:401:in `execute'
...
err: /Stage[main]//Exec[cmd.exe /c start notepad.exe]/returns: change from notrun to 0 failed: Permission denied - C:/Users/albert/AppData/Local/Temp/puppet20120611-804-150gmfc-0
notice: Finished catalog run in 1.50 seconds

Related issues

Related to Puppet - Bug #11563: Puppet on Windows can drop access control entries if the ... Accepted 12/26/2011

History

#1 Updated by Josh Cooper about 1 year ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Branch set to https://github.com/puppetlabs/puppet/pull/849

Pull request submitted. I thought about making the new behavior (ignoring Errno::EACCES) consistent across all platforms, but since the tempfile contains stdout of the child, including potentially security sensitive information, I decided not to change POSIX behavior.

#2 Updated by Patrick Carlisle 11 months ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release
  • Target version changed from 2.7.x to 2.7.18

#3 Updated by Josh Cooper 11 months ago

  • Target version changed from 2.7.18 to 2.7.19

#4 Updated by Josh Cooper 11 months ago

  • Status changed from Merged - Pending Release to Re-opened
  • Branch changed from https://github.com/puppetlabs/puppet/pull/849 to https://github.com/puppetlabs/puppet/pull/927

The way in which I was trying to handle Tempfile.close(true) relied on buggy ruby 1.8 behavior that changed in 1.9. Reopening this.

#5 Updated by Josh Cooper 11 months ago

  • Status changed from Re-opened to Merged - Pending Release

#6 Updated by Moses Mendoza 11 months ago

  • Status changed from Merged - Pending Release to Closed

Released in 2.7.19rc1.

#7 Updated by Matthaus Owens 10 months ago

Released in Puppet 3.0.0-rc4

Also available in: Atom PDF