diff --git a/rakelib/install.rake b/rakelib/install.rake index 424975a393..01e11b919c 100644 --- a/rakelib/install.rake +++ b/rakelib/install.rake @@ -95,6 +95,7 @@ namespace :install do FileList[ 'runtime/index', + 'runtime/signature', 'runtime/platform.conf', 'runtime/**/*.rb{a,c}', 'runtime/**/load_order.txt' diff --git a/rakelib/kernel.rake b/rakelib/kernel.rake index fb3080ebde..893db4658d 100644 --- a/rakelib/kernel.rake +++ b/rakelib/kernel.rake @@ -137,14 +137,14 @@ file compiler_signature => compiler_files + parser_ext_files do |t| hd = digest.hexdigest hash = hd[0, 16].to_i(16) ^ hd[16,16].to_i(16) ^ hd[32,8].to_i(16) - File.open t.name, "w" do |file| + File.open t.name, "wb" do |file| file.puts "# This file is generated by rakelib/kernel.rake. The signature" file.puts "# is used to ensure that only current .rbc files are loaded." file.puts "#" file.puts "Rubinius::Signature = #{hash}" end - File.open "runtime/signature", "w" do |file| + File.open "runtime/signature", "wb" do |file| file.puts hash end end diff --git a/vm/builtin/system.cpp b/vm/builtin/system.cpp index 002c41655c..5eea572bee 100644 --- a/vm/builtin/system.cpp +++ b/vm/builtin/system.cpp @@ -105,7 +105,7 @@ namespace rubinius { } uint64_t ver = version->to_ulong_long(); - if(ver > 0 && cf->version > 0 && cf->version != ver) { + if(ver > 0 && cf->version != ver) { return Primitives::failure(); } diff --git a/vm/environment.cpp b/vm/environment.cpp index 64c446f44d..dbf8b58c93 100644 --- a/vm/environment.cpp +++ b/vm/environment.cpp @@ -508,8 +508,8 @@ namespace rubinius { std::string dirs = root + "/index"; std::ifstream stream(dirs.c_str()); if(!stream) { - std::cerr << "It appears that " << root << "/index is missing.\n"; - exit(1); + std::string error = "Unable to load kernel index: " + root; + throw std::runtime_error(error); } // Load the ruby file to prepare for bootstrapping Ruby! @@ -526,7 +526,8 @@ namespace rubinius { Integer::from(state, signature_)); sig_stream.close(); } else { - G(rubinius)->set_const(state, "Signature", Integer::from(state, 0)); + std::string error = "Unable to load compiler signature file: " + sig_path; + throw std::runtime_error(error); } // Load alpha