From 7f78f182183e0f800fcfc53383833a235f159478 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 28 Dec 2013 13:45:36 -0700 Subject: [PATCH] core: handle EOFError when checking checksum [GH-2716] --- CHANGELOG.md | 2 ++ lib/vagrant/util/file_checksum.rb | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9083fe09..9f9e6df0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ BUG FIXES: - core: The version for `Vagrant.configure` can now be an int. [GH-2689] - core: `Vagrant.has_plugin?` tries to use plugin's gem name before registered plugin name [GH-2617] + - core: Fix exception if an EOFError was somehow raised by Ruby while + checking a box checksum. [GH-2716] ## 1.4.1 (December 18, 2013) diff --git a/lib/vagrant/util/file_checksum.rb b/lib/vagrant/util/file_checksum.rb index 28a21ccd0..d25b36b1d 100644 --- a/lib/vagrant/util/file_checksum.rb +++ b/lib/vagrant/util/file_checksum.rb @@ -28,8 +28,14 @@ class FileChecksum File.open(@path, "r") do |f| while !f.eof - buf = f.readpartial(BUFFER_SIZE) - digest.update(buf) + begin + buf = f.readpartial(BUFFER_SIZE) + digest.update(buf) + rescue EOFError + # Although we check for EOF earlier, this seems to happen + # sometimes anyways [GH-2716]. + break + end end end