Skip to content

Commit 99c8768

Browse files
committed
auto merge of #718 : alexcrichton/cargo/issue-715, r=brson
We won't make much progress reporting the error back up the chain, so we may as well carry on! Closes #715
2 parents 4f4bfba + f86aaed commit 99c8768

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/cargo/ops/cargo_read_manifest.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::collections::HashSet;
2-
use std::io::{File, fs};
2+
use std::io::{mod, File, fs};
33
use std::io::fs::PathExtensions;
44

55
use core::{Package,Manifest,SourceId};
6-
use util::{mod, CargoResult, human};
6+
use util::{mod, CargoResult, human, CargoError};
77
use util::important_paths::find_project_manifest_exact;
88
use util::toml::{Layout, project_layout};
99

@@ -61,7 +61,14 @@ fn walk(path: &Path, is_root: bool,
6161
return Ok(());
6262
}
6363

64-
for dir in try!(fs::readdir(path)).iter() {
64+
// Ignore any permission denied errors because temporary directories
65+
// can often have some weird permissions on them.
66+
let dirs = match fs::readdir(path) {
67+
Ok(dirs) => dirs,
68+
Err(ref e) if e.kind == io::PermissionDenied => return Ok(()),
69+
Err(e) => return Err(e.box_error()),
70+
};
71+
for dir in dirs.iter() {
6572
try!(walk(dir, false, |a, x| callback(a, x)))
6673
}
6774
}

tests/test_cargo_compile.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::io::{fs, TempDir, File};
1+
use std::io::{mod, fs, TempDir, File};
22
use std::os;
33
use std::path;
44

@@ -1669,3 +1669,18 @@ test!(recompile_space_in_name {
16691669
assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
16701670
execs().with_status(0).with_stdout(""));
16711671
})
1672+
1673+
test!(ignore_bad_directories {
1674+
let foo = project("foo")
1675+
.file("Cargo.toml", r#"
1676+
[package]
1677+
name = "foo"
1678+
version = "0.0.0"
1679+
authors = []
1680+
"#)
1681+
.file("src/lib.rs", "");
1682+
foo.build();
1683+
fs::mkdir(&foo.root().join("tmp"), io::USER_EXEC ^ io::USER_EXEC).unwrap();
1684+
assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
1685+
execs().with_status(0));
1686+
})

0 commit comments

Comments
 (0)