From 3212aa76cb0d2c0a16376e7fecdf0e54243518bc Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 16 May 2018 10:28:26 -0700 Subject: [PATCH] Add rust#50789 to fix same-version bootstrap We don't need to rebuild for this patch now, but it will correct the FTBFS that Koschei is currently reporting. --- ...-built-in-stage0-have-unique-metadat.patch | 40 +++++++++++++++++++ rust.spec | 4 ++ 2 files changed, 44 insertions(+) create mode 100644 0001-Ensure-libraries-built-in-stage0-have-unique-metadat.patch diff --git a/0001-Ensure-libraries-built-in-stage0-have-unique-metadat.patch b/0001-Ensure-libraries-built-in-stage0-have-unique-metadat.patch new file mode 100644 index 0000000..38a4402 --- /dev/null +++ b/0001-Ensure-libraries-built-in-stage0-have-unique-metadat.patch @@ -0,0 +1,40 @@ +From e8e5eb58c0d6890f73ea01354e18f51b1a6697f8 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Tue, 15 May 2018 17:48:02 -0700 +Subject: [PATCH] Ensure libraries built in stage0 have unique metadata + +Issue #50786 shows a case with local rebuild where the libraries built +by stage0 had the same suffix as stage0's own, and were accidentally +loaded by that stage0 rustc when compiling `librustc_trans`. + +Now we set `__CARGO_DEFAULT_LIB_METADATA` to "bootstrap" during stage0, +rather than the release channel like usual, so the library suffix will +always be completely distinct from the stage0 compiler. +--- + src/bootstrap/builder.rs | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs +index 17f19222e6ea..e5824010ef2c 100644 +--- a/src/bootstrap/builder.rs ++++ b/src/bootstrap/builder.rs +@@ -592,7 +592,15 @@ impl<'a> Builder<'a> { + + // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005 + // Force cargo to output binaries with disambiguating hashes in the name +- cargo.env("__CARGO_DEFAULT_LIB_METADATA", &self.config.channel); ++ let metadata = if compiler.stage == 0 { ++ // Treat stage0 like special channel, whether it's a normal prior- ++ // release rustc or a local rebuild with the same version, so we ++ // never mix these libraries by accident. ++ "bootstrap" ++ } else { ++ &self.config.channel ++ }; ++ cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata); + + let stage; + if compiler.stage == 0 && self.local_rebuild { +-- +2.17.0 + diff --git a/rust.spec b/rust.spec index 8056f30..dffd331 100644 --- a/rust.spec +++ b/rust.spec @@ -72,6 +72,9 @@ Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz # https://github.com/rust-lang/rust/pull/49959 Patch1: pull-49959.patch +# https://github.com/rust-lang/rust/pull/50789/ +Patch2: 0001-Ensure-libraries-built-in-stage0-have-unique-metadat.patch + # Get the Rust triple for any arch. %{lua: function rust_triple(arch) local abi = "gnu" @@ -372,6 +375,7 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} %patch1 -p1 +%patch2 -p1 %if "%{python}" == "python3" sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure