-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc: Prevent false positives in crate loading
Previously, any library of the pattern `lib<name>-<hash>-<version>.so` was >considered a candidate (rightly so) for loading a crate. Sets are generated for each unique `<hash>`, and then from these sets a candidate is selected. If a set contained more than one element, then it immediately generated an error saying that multiple copies of the same dylib were found. This is incorrect because each candidate needs to be validated to actually contain a rust library (valid metadata). This commit alters the logic to filter each set of candidates for a hash to only libraries which are actually rust libraries. This means that if multiple false positives are found with the right name pattern, they're all ignored. Closes #13010
- Loading branch information
1 parent
af93684
commit 068740b
Showing
4 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-include ../tools.mk | ||
|
||
all: | ||
$(RUSTC) foo.rs | ||
touch $(call DYLIB,foo-something-special) | ||
touch $(call DYLIB,foo-something-special2) | ||
$(RUSTC) bar.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
extern crate foo; | ||
|
||
fn main() { foo::foo() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#[crate_type = "dylib"]; | ||
|
||
pub fn foo() {} |
068740b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from huonw
at alexcrichton@068740b
068740b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-13010 = 068740b into auto
068740b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-13010 = 068740b merged ok, testing candidate = c01e2f0
068740b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/4775
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/4770
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/3867
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/3876
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/4874
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/3962
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/3969
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/4876
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/3962
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/3967
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/4035
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1766
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/4873
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/3973
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/3981
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/4635
068740b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = c01e2f0