Skip to content

Bug #17898 Dir.mktmpdir not supported under Ruby 1.8.6#1311

Closed
mrrcollins wants to merge 2 commits intopuppetlabs:masterfrom
mrrcollins:master
Closed

Bug #17898 Dir.mktmpdir not supported under Ruby 1.8.6#1311
mrrcollins wants to merge 2 commits intopuppetlabs:masterfrom
mrrcollins:master

Conversation

@mrrcollins
Copy link
Contributor

Bug #17898 pkgdmg provider broken since version 2.7.13 under OS X 10.5 Leopard

Dir.mktempdir was added in Puppet 2.7.13 as a security issue to randomize the location of downloaded files, with the unfortunate side affect of breaking Puppet under OS X 10.5.

This change fixes the issue in pkgdmg.rb and appdmg.rb

@mrrcollins
Copy link
Contributor Author

Added to monkey_patches.rb!

@mrrcollins mrrcollins closed this Dec 4, 2012
@ahpook
Copy link
Contributor

ahpook commented Dec 4, 2012

@joshcooper sorry this confusion was my fault, due to misunderstanding the support matrix. (because the support matrix is easy to misunderstand, perhaps) -- we say we support Mac OS X 10.5 but do not say that you have to replace the system Ruby in order for it to actually be supported.

@joshcooper
Copy link
Contributor

@mrrcollins I was under the impression that the Dir.mktmpdir isn't present in 1.8.6. Can you confirm if that's the case? I ask because @ahpook sent me this http://mikbe.tk/2011/03/07/temporary-directory, so it may be that the providers just need to explicitly require 'tmpdir'.

@mrrcollins
Copy link
Contributor Author

I don't think it exists under 1.8.5, which is supported. At least that's what I'm assuming when I found this:
https://github.com/puppetlabs/hiera/pull/47/files

I added that code to monkey_patches.rb and requested another pull (I've never done this before, bear with me. :-)

Testing with irb under 1.8.6 (OS X 10.5)

>> require 'tmpdir'
=> true
>> x = Dir.mktmpdir
NoMethodError: undefined method `mktmpdir' for Dir:Class
    from (irb):2
    from :0

@jeffmccune
Copy link
Contributor

On Tue, Dec 4, 2012 at 2:17 PM, Ryan Collins notifications@github.comwrote:

I don't think it exists under 1.8.5, which is supported. At least that's
what I'm assuming when I found this:
https://github.com/puppetlabs/hiera/pull/47/files

That's really strange. Are you sure you're using the ruby that came with
Mac OS X 10.5 ? I ask because according to Apple's Open Source repository,
this method shoudl definitely be present already:

http://opensource.apple.com/source/ruby/ruby-67/ruby/lib/tmpdir.rb

-Jeff

@mrrcollins
Copy link
Contributor Author

tmpdir is there, mktmpdir is not. :-) From what I can tell, it was added in Ruby 1.8.7.

@jeffmccune
Copy link
Contributor

Oh yeah, whoops. I overlooked that mktmpdir is not defined in the 1.8.6
source.

-Jeff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants