Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo inserts an empty path in LD_LIBRARY_PATH #4277

Closed
sfackler opened this issue Jul 12, 2017 · 2 comments · Fixed by #4278
Closed

cargo inserts an empty path in LD_LIBRARY_PATH #4277

sfackler opened this issue Jul 12, 2017 · 2 comments · Fixed by #4278

Comments

@sfackler
Copy link
Member

This causes lookup to check the working directory which is not good.

cc rust-lang/rust#42851

@codyps
Copy link
Contributor

codyps commented Jul 13, 2017

Introduced by "[784d315] set dylib path correctly for target when running cargo test etc" #4006

cc: @mcgoo @alexcrichton

test:

extern crate cargotest;
extern crate hamcrest;

use cargotest::support::{execs, project};
use hamcrest::assert_that;

#[test]
fn build_with_fake_libc_not_loading() {
    let p = project("foo")
        .file("Cargo.toml", r#"
            [package]
            name = "foo"
            version = "0.0.1"
            authors = []
        "#)
        .file("src/main.rs", r#"
            fn main() {}
        "#)
        .file("src/lib.rs", r#" "#)
        .file("libc.so.6", r#""#);

    assert_that(p.cargo_process("build"), execs().with_status(0));
}

@mbrubeck
Copy link
Contributor

mbrubeck commented Jul 13, 2017

#4006 added lines like this:

 search_path.push(self.host_dylib_path.iter().collect());

where search_path is a Vec<PathBuf> and self.host_dylib_path is an Option<PathBuf>. If self.host_dylib_path is set to None then this will push an empty path into the search path. There is a fix for this in #4278.

mbrubeck added a commit to mbrubeck/cargo that referenced this issue Jul 13, 2017
bors added a commit that referenced this issue Jul 13, 2017
Don't push empty paths in LD_LIBRARY_PATH

Fixes #4277.  Note: I haven't written a test for this fix yet.
alexcrichton pushed a commit to alexcrichton/cargo that referenced this issue Jul 13, 2017
bors added a commit that referenced this issue Jul 13, 2017
[beta] Don't push empty paths in LD_LIBRARY_PATH

Fixes #4277.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants