summaryrefslogtreecommitdiffstats
path: root/vendor/walkdir
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/walkdir')
-rw-r--r--vendor/walkdir/.cargo-checksum.json2
-rw-r--r--vendor/walkdir/Cargo.toml2
-rw-r--r--vendor/walkdir/src/lib.rs27
-rw-r--r--vendor/walkdir/src/tests/recursive.rs71
4 files changed, 98 insertions, 4 deletions
diff --git a/vendor/walkdir/.cargo-checksum.json b/vendor/walkdir/.cargo-checksum.json
index d90dfa135..dba6351b9 100644
--- a/vendor/walkdir/.cargo-checksum.json
+++ b/vendor/walkdir/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"ca0ae974da5ac27e19ee2644ad445056f121f74ece668103c48f6a9efbc09c71","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"5fc28c8211fe74af2889a2eb859127f8d543e0f94be80659c307105ed831f84b","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","compare/nftw.c":"6b900b0ac78ce8ece1995f834b194fa14d87d744cabba8f475f0e10b21722c56","compare/walk.py":"d49e26d0b8b2b201d00f2f46bf1f9db46f873c27332da679c9a7adbbf54462d2","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/dent.rs":"ca573f4533370a09851579f5940f7cd9bd121b2f30ec51d29a40afdce984683b","src/error.rs":"ba58bf6f59d196567435d4b66699a928cc237fc7c8df01dc37ab822509905b7c","src/lib.rs":"d964635f63cd73487c10a4e32440c30d9d25c43baca02d2f5313b48cd9a40e1c","src/tests/mod.rs":"bbce9174bfdbb4a81a9000f702be056b63b439cb8f1bcac64b8569368627d56d","src/tests/recursive.rs":"1afd9bb86cb04e8fead4d1e075efe00f6e16d7cf17bb3014f8c94e8adf869bea","src/tests/util.rs":"ca72ef96f82bb87d8c93d13d581ebb65efcd53fffa87097a84437acecbc30faa","src/util.rs":"14e0da711cad4825ead21446cd61a1444fd49bab853a8a239d8cb74b2caab351"},"package":"36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"} \ No newline at end of file
+{"files":{"COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"e7c4db380e4ac3135c94dd92324d64c89b988d0b62d1aa41c9d2b5448b0e9f70","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"5fc28c8211fe74af2889a2eb859127f8d543e0f94be80659c307105ed831f84b","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","compare/nftw.c":"6b900b0ac78ce8ece1995f834b194fa14d87d744cabba8f475f0e10b21722c56","compare/walk.py":"d49e26d0b8b2b201d00f2f46bf1f9db46f873c27332da679c9a7adbbf54462d2","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/dent.rs":"ca573f4533370a09851579f5940f7cd9bd121b2f30ec51d29a40afdce984683b","src/error.rs":"ba58bf6f59d196567435d4b66699a928cc237fc7c8df01dc37ab822509905b7c","src/lib.rs":"cee55b7b95cc8e8613ee47aae6a7ee47d3b6258e690128ff69f0d4da1feed374","src/tests/mod.rs":"bbce9174bfdbb4a81a9000f702be056b63b439cb8f1bcac64b8569368627d56d","src/tests/recursive.rs":"b6305e7cc9f905ce6b7328ac9fb5b07e5a73fa549c0b84ef890fb442d1bbcb7c","src/tests/util.rs":"ca72ef96f82bb87d8c93d13d581ebb65efcd53fffa87097a84437acecbc30faa","src/util.rs":"14e0da711cad4825ead21446cd61a1444fd49bab853a8a239d8cb74b2caab351"},"package":"d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"} \ No newline at end of file
diff --git a/vendor/walkdir/Cargo.toml b/vendor/walkdir/Cargo.toml
index 7db926327..4c29a20f2 100644
--- a/vendor/walkdir/Cargo.toml
+++ b/vendor/walkdir/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "walkdir"
-version = "2.3.3"
+version = "2.4.0"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
exclude = [
"/ci/*",
diff --git a/vendor/walkdir/src/lib.rs b/vendor/walkdir/src/lib.rs
index 4d41515df..edf702e4a 100644
--- a/vendor/walkdir/src/lib.rs
+++ b/vendor/walkdir/src/lib.rs
@@ -237,6 +237,7 @@ pub struct WalkDir {
struct WalkDirOptions {
follow_links: bool,
+ follow_root_links: bool,
max_open: usize,
min_depth: usize,
max_depth: usize,
@@ -265,6 +266,7 @@ impl fmt::Debug for WalkDirOptions {
};
f.debug_struct("WalkDirOptions")
.field("follow_links", &self.follow_links)
+ .field("follow_root_link", &self.follow_root_links)
.field("max_open", &self.max_open)
.field("min_depth", &self.min_depth)
.field("max_depth", &self.max_depth)
@@ -287,6 +289,7 @@ impl WalkDir {
WalkDir {
opts: WalkDirOptions {
follow_links: false,
+ follow_root_links: true,
max_open: 10,
min_depth: 0,
max_depth: ::std::usize::MAX,
@@ -344,6 +347,25 @@ impl WalkDir {
self
}
+ /// Follow symbolic links if these are the root of the traversal.
+ /// By default, this is enabled.
+ ///
+ /// When `yes` is `true`, symbolic links on root paths are followed
+ /// which is effective if the symbolic link points to a directory.
+ /// If a symbolic link is broken or is involved in a loop, an error is yielded
+ /// as the first entry of the traversal.
+ ///
+ /// When enabled, the yielded [`DirEntry`] values represent the target of
+ /// the link while the path corresponds to the link. See the [`DirEntry`]
+ /// type for more details, and all future entries will be contained within
+ /// the resolved directory behind the symbolic link of the root path.
+ ///
+ /// [`DirEntry`]: struct.DirEntry.html
+ pub fn follow_root_links(mut self, yes: bool) -> Self {
+ self.opts.follow_root_links = yes;
+ self
+ }
+
/// Set the maximum number of simultaneously open file descriptors used
/// by the iterator.
///
@@ -830,7 +852,10 @@ impl IntoIter {
} else {
itry!(self.push(&dent));
}
- } else if dent.depth() == 0 && dent.file_type().is_symlink() {
+ } else if dent.depth() == 0
+ && dent.file_type().is_symlink()
+ && self.opts.follow_root_links
+ {
// As a special case, if we are processing a root entry, then we
// always follow it even if it's a symlink and follow_links is
// false. We are careful to not let this change the semantics of
diff --git a/vendor/walkdir/src/tests/recursive.rs b/vendor/walkdir/src/tests/recursive.rs
index 4119f461d..e415b9182 100644
--- a/vendor/walkdir/src/tests/recursive.rs
+++ b/vendor/walkdir/src/tests/recursive.rs
@@ -383,7 +383,76 @@ fn sym_root_file_follow() {
}
#[test]
-fn sym_root_dir_nofollow() {
+fn broken_sym_root_dir_nofollow_and_root_nofollow() {
+ let dir = Dir::tmp();
+ dir.symlink_dir("broken", "a-link");
+
+ let wd = WalkDir::new(dir.join("a-link"))
+ .follow_links(false)
+ .follow_root_links(false);
+ let r = dir.run_recursive(wd);
+ let ents = r.sorted_ents();
+ assert_eq!(ents.len(), 1);
+ let link = &ents[0];
+ assert_eq!(dir.join("a-link"), link.path());
+ assert!(link.path_is_symlink());
+}
+
+#[test]
+fn broken_sym_root_dir_follow_and_root_nofollow() {
+ let dir = Dir::tmp();
+ dir.symlink_dir("broken", "a-link");
+
+ let wd = WalkDir::new(dir.join("a-link"))
+ .follow_links(true)
+ .follow_root_links(false);
+ let r = dir.run_recursive(wd);
+ assert!(r.sorted_ents().is_empty());
+ assert_eq!(
+ r.errs().len(),
+ 1,
+ "broken symlink cannot be traversed - they are followed if symlinks are followed"
+ );
+}
+
+#[test]
+fn broken_sym_root_dir_root_is_always_followed() {
+ let dir = Dir::tmp();
+ dir.symlink_dir("broken", "a-link");
+
+ for follow_symlinks in &[true, false] {
+ let wd =
+ WalkDir::new(dir.join("a-link")).follow_links(*follow_symlinks);
+ let r = dir.run_recursive(wd);
+ assert!(r.sorted_ents().is_empty());
+ assert_eq!(
+ r.errs().len(),
+ 1,
+ "broken symlink in roots cannot be traversed, they are always followed"
+ );
+ }
+}
+
+#[test]
+fn sym_root_dir_nofollow_root_nofollow() {
+ let dir = Dir::tmp();
+ dir.mkdirp("a");
+ dir.symlink_dir("a", "a-link");
+ dir.touch("a/zzz");
+
+ let wd = WalkDir::new(dir.join("a-link")).follow_root_links(false);
+ let r = dir.run_recursive(wd);
+ r.assert_no_errors();
+
+ let ents = r.sorted_ents();
+ assert_eq!(1, ents.len());
+ let link = &ents[0];
+ assert_eq!(dir.join("a-link"), link.path());
+ assert_eq!(0, link.depth());
+}
+
+#[test]
+fn sym_root_dir_nofollow_root_follow() {
let dir = Dir::tmp();
dir.mkdirp("a");
dir.symlink_dir("a", "a-link");