diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index 37cefbc52f..953ee3f222 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -35,7 +35,6 @@ use itertools::Itertools; use rustup::{NotifyHandler}; use errors::*; use rustup_dist::dist; -use rustup_dist; use rustup_utils::utils; use openssl::crypto::hash::{Type, Hasher}; use std::env; @@ -1077,11 +1076,8 @@ pub fn prepare_update() -> Result> { // Check that hash is correct if latest_hash != download_hash { - return Err(ErrorKind::Dist(rustup_dist::ErrorKind::ChecksumFailed { - url: url, - expected: latest_hash, - calculated: download_hash, - }).into()); + info!("update not yet available. bug #364"); + return Ok(None); } // Mark as executable diff --git a/tests/cli-self-update.rs b/tests/cli-self-update.rs index fac083868f..752e95a7a2 100644 --- a/tests/cli-self-update.rs +++ b/tests/cli-self-update.rs @@ -22,10 +22,9 @@ use std::process::Command; use rustup_mock::clitools::{self, Config, Scenario, expect_ok, expect_ok_ex, expect_stdout_ok, + expect_stderr_ok, expect_err, expect_err_ex, this_host_triple}; -#[cfg(windows)] -use rustup_mock::clitools::expect_stderr_ok; use rustup_mock::dist::{create_hash, calc_hash}; use rustup_mock::{get_path, restore_path}; use rustup_utils::raw; @@ -520,6 +519,7 @@ info: rustup is up to date } #[test] +#[ignore] // Workaround for #346 fn update_bad_hash() { update_setup(&|config, self_dist| { expect_ok(config, &["rustup-init", "-y"]); @@ -537,6 +537,25 @@ fn update_bad_hash() { }); } +// Workaround for #346 +#[test] +fn update_hash_drift() { + update_setup(&|config, self_dist| { + expect_ok(config, &["rustup-init", "-y"]); + + let ref trip = this_host_triple(); + let ref dist_dir = self_dist.join(&format!("{}", trip)); + let ref dist_hash = dist_dir.join(&format!("rustup-init{}.sha256", EXE_SUFFIX)); + + let ref some_other_file = config.distdir.join("dist/channel-rust-nightly.toml"); + + create_hash(some_other_file, dist_hash); + + expect_stderr_ok(config, &["rustup", "self", "update"], + "update not yet available"); + }); +} + #[test] fn update_hash_file_404() { update_setup(&|config, self_dist| {