Fix obscure error with world writable temp dir
This commit is contained in:
parent
ffae6bb4cd
commit
7e125db669
|
@ -19,6 +19,8 @@ BUG FIXES:
|
||||||
- Chef solo `recipe_url` works properly again. [GH-1467]
|
- Chef solo `recipe_url` works properly again. [GH-1467]
|
||||||
- Port collision detection works properly in VirtualBox with
|
- Port collision detection works properly in VirtualBox with
|
||||||
auto-corrected ports. [GH-1472]
|
auto-corrected ports. [GH-1472]
|
||||||
|
- Fix obscure error when temp directory is world writable when
|
||||||
|
adding boxes.
|
||||||
|
|
||||||
## 1.1.2 (March 18, 2013)
|
## 1.1.2 (March 18, 2013)
|
||||||
|
|
||||||
|
|
|
@ -96,15 +96,13 @@ module Vagrant
|
||||||
|
|
||||||
# Create a temporary directory since we're not sure at this point if
|
# 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)
|
# the box we're unpackaging already exists (if no provider was given)
|
||||||
Dir.mktmpdir(TEMP_PREFIX) do |temp_dir|
|
temp_dir = Pathname.new(Dir.mktmpdir(TEMP_PREFIX))
|
||||||
temp_dir = Pathname.new(temp_dir)
|
|
||||||
|
|
||||||
# Extract the box into a temporary directory.
|
# Extract the box into a temporary directory.
|
||||||
@logger.debug("Unpacking box into temporary directory: #{temp_dir}")
|
@logger.debug("Unpacking box into temporary directory: #{temp_dir}")
|
||||||
result = Util::Subprocess.execute(
|
result = Util::Subprocess.execute(
|
||||||
"bsdtar", "-v", "-x", "-C", temp_dir.to_s, "-f", path.to_s)
|
"bsdtar", "-v", "-x", "-C", temp_dir.to_s, "-f", path.to_s)
|
||||||
raise Errors::BoxUnpackageFailure, :output => result.stderr.to_s \
|
raise Errors::BoxUnpackageFailure, :output => result.stderr.to_s if result.exit_code != 0
|
||||||
if result.exit_code != 0
|
|
||||||
|
|
||||||
# If we get a V1 box, we want to update it in place
|
# If we get a V1 box, we want to update it in place
|
||||||
if v1_box?(temp_dir)
|
if v1_box?(temp_dir)
|
||||||
|
@ -157,7 +155,9 @@ module Vagrant
|
||||||
@logger.debug("Moving: #{f} => #{destination}")
|
@logger.debug("Moving: #{f} => #{destination}")
|
||||||
FileUtils.mv(f, destination)
|
FileUtils.mv(f, destination)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
# Remove the temporary directory
|
||||||
|
temp_dir.rmtree
|
||||||
|
|
||||||
# Return the box
|
# Return the box
|
||||||
find(name, provider)
|
find(name, provider)
|
||||||
|
|
Loading…
Reference in New Issue