Fix obscure error with world writable temp dir

This commit is contained in:
Mitchell Hashimoto 2013-03-21 17:31:23 -07:00
parent ffae6bb4cd
commit 7e125db669
2 changed files with 61 additions and 59 deletions

View File

@ -19,6 +19,8 @@ BUG FIXES:
- Chef solo `recipe_url` works properly again. [GH-1467]
- Port collision detection works properly in VirtualBox with
auto-corrected ports. [GH-1472]
- Fix obscure error when temp directory is world writable when
adding boxes.
## 1.1.2 (March 18, 2013)

View File

@ -96,15 +96,13 @@ module Vagrant
# Create a temporary directory since we're not sure at this point if
# the box we're unpackaging already exists (if no provider was given)
Dir.mktmpdir(TEMP_PREFIX) do |temp_dir|
temp_dir = Pathname.new(temp_dir)
temp_dir = Pathname.new(Dir.mktmpdir(TEMP_PREFIX))
# Extract the box into a temporary directory.
@logger.debug("Unpacking box into temporary directory: #{temp_dir}")
result = Util::Subprocess.execute(
"bsdtar", "-v", "-x", "-C", temp_dir.to_s, "-f", path.to_s)
raise Errors::BoxUnpackageFailure, :output => result.stderr.to_s \
if result.exit_code != 0
raise Errors::BoxUnpackageFailure, :output => result.stderr.to_s if result.exit_code != 0
# If we get a V1 box, we want to update it in place
if v1_box?(temp_dir)
@ -157,7 +155,9 @@ module Vagrant
@logger.debug("Moving: #{f} => #{destination}")
FileUtils.mv(f, destination)
end
end
# Remove the temporary directory
temp_dir.rmtree
# Return the box
find(name, provider)