Update glob to 0.3.2
Test: m
Change-Id: I75d50f9da77418316584211af11d3d2395a2a79e
diff --git a/crates/glob/.android-checksum.json b/crates/glob/.android-checksum.json
index 362f196..0ec607e 100644
--- a/crates/glob/.android-checksum.json
+++ b/crates/glob/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"56c05b47b3bd5f8a50209ede542ce32a014163a618ea3027437e222a8e445921","Android.bp":"fdd29ea6f8b390632376a9af2d34cbbd67fa3886f5e85c7bdfa1ef0ae4d50bd0","Cargo.toml":"db5e77f01bed9cb4eb68ec0c7f6e43b37ca1ad893c55a77bdae40c47b3d77ae3","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"16693a68efd65bc6a9df3448c8f7ee6745418c73faff4ec4d443648c04285fa4","METADATA":"02117073c3090159bc4902a032a20695e8beaf2da035ef5db780adee89302252","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"aba9a7f946a48d0d78dd89df774679bd5547f43c88a7d6beb7d7f9d9a985b35d","TEST_MAPPING":"b980f27af06453e486aff3e93847a38c3886881743d109a9d083b8e6b60bee1d","cargo_embargo.json":"835449d98b03d5d6ff2bd412b91567eb90dc4f181fd463c1a03e27da48d5fc09","src/lib.rs":"57d02cd4f63fea2f731b13b0f57d044fe8de5f66586a5d0f53d1e9159b3f821b","tests/glob-std.rs":"6a2870563677f30c89621489320114738f811aa839d1f35bf94ec8251cf5b4fe","triagebot.toml":"26772e45fe413284e600760236cfd60cb726b7ae47fde22f2f9c474bd27ff8b0"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"ae557f3c5767619683fb8e1984ad583a77abae31389f62f253a96fdfc63423d5","Android.bp":"762fed9f6a48885b941666fc80aea256e62ac19c5e6a307827353a8d0459625a","CHANGELOG.md":"7feee48475b592d2d959405781a99681a181ff9186aa2fd1205ed19090346d0b","Cargo.toml":"5dccc7bdbde6dcd53bbfb87bccffeb4ddea12ba7b237751b73488f29d1c1428a","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"16693a68efd65bc6a9df3448c8f7ee6745418c73faff4ec4d443648c04285fa4","METADATA":"92b39b23acc9ebdb746c462c9123bfcdff272fbc7186632f0f424d385fb69bdf","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"8f98d8cbf55a6dd30313b80844fb06971334a66fe1b86164044369d35f29f912","TEST_MAPPING":"b980f27af06453e486aff3e93847a38c3886881743d109a9d083b8e6b60bee1d","cargo_embargo.json":"835449d98b03d5d6ff2bd412b91567eb90dc4f181fd463c1a03e27da48d5fc09","src/lib.rs":"b6eb28092e25512f3bac59134072b036ad34b546d8317ff49f16173b9a3025a6","tests/glob-std.rs":"0c22b6efd6add7f65e26502a10a4f1902709e98a56b6373ac4072ac8e86279b5","triagebot.toml":"26772e45fe413284e600760236cfd60cb726b7ae47fde22f2f9c474bd27ff8b0"}}
\ No newline at end of file
diff --git a/crates/glob/.cargo-checksum.json b/crates/glob/.cargo-checksum.json
index e31f7a6..aebac2d 100644
--- a/crates/glob/.cargo-checksum.json
+++ b/crates/glob/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"6791dcdd292ecaeeec9535afae7189026dca9d8486211acd27208673edfa995a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"3482ed957e7e22efdf5f368d92c497b932c665bce3ad17db8ec31c1007164539","src/lib.rs":"b2f3c3f48eb07f1767a7e5bb02847d10e02655f1dbf57281eb63fd001427e28b","tests/glob-std.rs":"b0a0aa11d7b8cc2cc0216fb117a543d6e584eec8b51173994dfd19761ab00a62","triagebot.toml":"a135e10c777cd13459559bdf74fb704c1379af7c9b0f70bc49fa6f5a837daa81"},"package":"d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"}
\ No newline at end of file
+{"files":{"CHANGELOG.md":"1d58b475783a53a2c20c8682dd666c0b3d95e3923b85c5b03eb577762178ea90","Cargo.toml":"b0fe646251875bd2b4ac71d55758fce1a58499a381d889cdec6c294064413410","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"8f2d321242fc17deb4e61d9cfbaec7b68ff532e0f458190d01668b37e34bfc2f","src/lib.rs":"eceab024b44237b5960e6c3625a0449c15bcf8409fa52401c83d4287f2c0fbce","tests/glob-std.rs":"83bf0b8371190832e85ed1ab8a335df3d8c03fab529694577d722dd1a0a5f398","triagebot.toml":"a135e10c777cd13459559bdf74fb704c1379af7c9b0f70bc49fa6f5a837daa81"},"package":"a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"}
\ No newline at end of file
diff --git a/crates/glob/Android.bp b/crates/glob/Android.bp
index 9f58735..154f0cc 100644
--- a/crates/glob/Android.bp
+++ b/crates/glob/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "glob",
cargo_env_compat: true,
- cargo_pkg_version: "0.3.1",
+ cargo_pkg_version: "0.3.2",
crate_root: "src/lib.rs",
edition: "2015",
apex_available: [
diff --git a/crates/glob/CHANGELOG.md b/crates/glob/CHANGELOG.md
new file mode 100644
index 0000000..11d7f62
--- /dev/null
+++ b/crates/glob/CHANGELOG.md
@@ -0,0 +1,33 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+## [Unreleased]
+
+## [0.3.2](https://github.com/rust-lang/glob/compare/v0.3.1...v0.3.2) - 2024-12-28
+
+## What's Changed
+* Add fs::symlink_metadata to detect broken symlinks by @kyoheiu in https://github.com/rust-lang/glob/pull/105
+* Add support for windows verbatim disk paths by @nico-abram in https://github.com/rust-lang/glob/pull/112
+* Respect `require_literal_leading_dot` option in `glob_with` method for path components by @JohnTitor in https://github.com/rust-lang/glob/pull/128
+* Harden tests for symlink by @JohnTitor in https://github.com/rust-lang/glob/pull/127
+* Remove "extern crate" directions from README by @zmitchell in https://github.com/rust-lang/glob/pull/131
+* Add FIXME for tempdir by @JohnTitor in https://github.com/rust-lang/glob/pull/126
+* Cache information about file type by @Kobzol in https://github.com/rust-lang/glob/pull/135
+* Document the behaviour of ** with files by @Wilfred in https://github.com/rust-lang/glob/pull/138
+* Add dependabot by @oriontvv in https://github.com/rust-lang/glob/pull/139
+* Bump actions/checkout from 3 to 4 by @dependabot in https://github.com/rust-lang/glob/pull/140
+* Check only (no longer test) at the MSRV by @tgross35 in https://github.com/rust-lang/glob/pull/151
+* Add release-plz for automated releases by @tgross35 in https://github.com/rust-lang/glob/pull/150
+
+## New Contributors
+* @kyoheiu made their first contribution in https://github.com/rust-lang/glob/pull/105
+* @nico-abram made their first contribution in https://github.com/rust-lang/glob/pull/112
+* @zmitchell made their first contribution in https://github.com/rust-lang/glob/pull/131
+* @Kobzol made their first contribution in https://github.com/rust-lang/glob/pull/135
+* @Wilfred made their first contribution in https://github.com/rust-lang/glob/pull/138
+* @oriontvv made their first contribution in https://github.com/rust-lang/glob/pull/139
+* @dependabot made their first contribution in https://github.com/rust-lang/glob/pull/140
+* @tgross35 made their first contribution in https://github.com/rust-lang/glob/pull/151
+
+**Full Changelog**: https://github.com/rust-lang/glob/compare/0.3.1...0.3.2
diff --git a/crates/glob/Cargo.toml b/crates/glob/Cargo.toml
index 5397717..59393e1 100644
--- a/crates/glob/Cargo.toml
+++ b/crates/glob/Cargo.toml
@@ -10,9 +10,16 @@
# See Cargo.toml.orig for the original contents.
[package]
+rust-version = "1.23.0"
name = "glob"
-version = "0.3.1"
+version = "0.3.2"
authors = ["The Rust Project Developers"]
+build = false
+autolib = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = """
Support for matching file paths against Unix shell style patterns.
"""
@@ -23,6 +30,14 @@
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/glob"
+[lib]
+name = "glob"
+path = "src/lib.rs"
+
+[[test]]
+name = "glob-std"
+path = "tests/glob-std.rs"
+
[dev-dependencies.doc-comment]
version = "0.3"
diff --git a/crates/glob/METADATA b/crates/glob/METADATA
index b4815a1..6238def 100644
--- a/crates/glob/METADATA
+++ b/crates/glob/METADATA
@@ -1,17 +1,17 @@
name: "glob"
description: "Support for matching file paths against Unix shell style patterns."
third_party {
- version: "0.3.1"
+ version: "0.3.2"
license_type: NOTICE
last_upgrade_date {
- year: 2023
- month: 2
- day: 2
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/glob"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/glob/glob-0.3.1.crate"
- version: "0.3.1"
+ value: "https://static.crates.io/crates/glob/glob-0.3.2.crate"
+ version: "0.3.2"
}
}
diff --git a/crates/glob/README.md b/crates/glob/README.md
index b68a40e..36302ee 100644
--- a/crates/glob/README.md
+++ b/crates/glob/README.md
@@ -16,8 +16,7 @@
glob = "0.3.1"
```
-And add this to your crate root:
-
+If you're using Rust 1.30 or earlier, or edition 2015, add this to your crate root:
```rust
extern crate glob;
```
diff --git a/crates/glob/src/lib.rs b/crates/glob/src/lib.rs
index 744cabf..fef8090 100644
--- a/crates/glob/src/lib.rs
+++ b/crates/glob/src/lib.rs
@@ -73,7 +73,9 @@
use std::error::Error;
use std::fmt;
use std::fs;
+use std::fs::DirEntry;
use std::io;
+use std::ops::Deref;
use std::path::{self, Component, Path, PathBuf};
use std::str::FromStr;
@@ -96,8 +98,8 @@
dir_patterns: Vec<Pattern>,
require_dir: bool,
options: MatchOptions,
- todo: Vec<Result<(PathBuf, usize), GlobError>>,
- scope: Option<PathBuf>,
+ todo: Vec<Result<(PathWrapper, usize), GlobError>>,
+ scope: Option<PathWrapper>,
}
/// Return an iterator that produces all the `Path`s that match the given
@@ -178,7 +180,15 @@
#[cfg(windows)]
fn check_windows_verbatim(p: &Path) -> bool {
match p.components().next() {
- Some(Component::Prefix(ref p)) => p.kind().is_verbatim(),
+ Some(Component::Prefix(ref p)) => {
+ // Allow VerbatimDisk paths. std canonicalize() generates them, and they work fine
+ p.kind().is_verbatim()
+ && if let std::path::Prefix::VerbatimDisk(_) = p.kind() {
+ false
+ } else {
+ true
+ }
+ }
_ => false,
}
}
@@ -234,6 +244,7 @@
}
let scope = root.map_or_else(|| PathBuf::from("."), to_scope);
+ let scope = PathWrapper::from_path(scope);
let mut dir_patterns = Vec::new();
let components =
@@ -315,8 +326,52 @@
}
}
-fn is_dir(p: &Path) -> bool {
- fs::metadata(p).map(|m| m.is_dir()).unwrap_or(false)
+#[derive(Debug)]
+struct PathWrapper {
+ path: PathBuf,
+ is_directory: bool,
+}
+
+impl PathWrapper {
+ fn from_dir_entry(path: PathBuf, e: DirEntry) -> Self {
+ let is_directory = e
+ .file_type()
+ .ok()
+ .and_then(|file_type| {
+ // We need to use fs::metadata to resolve the actual path
+ // if it's a symlink.
+ if file_type.is_symlink() {
+ None
+ } else {
+ Some(file_type.is_dir())
+ }
+ })
+ .or_else(|| fs::metadata(&path).map(|m| m.is_dir()).ok())
+ .unwrap_or(false);
+ Self { path, is_directory }
+ }
+ fn from_path(path: PathBuf) -> Self {
+ let is_directory = fs::metadata(&path).map(|m| m.is_dir()).unwrap_or(false);
+ Self { path, is_directory }
+ }
+
+ fn into_path(self) -> PathBuf {
+ self.path
+ }
+}
+
+impl Deref for PathWrapper {
+ type Target = Path;
+
+ fn deref(&self) -> &Self::Target {
+ self.path.deref()
+ }
+}
+
+impl AsRef<Path> for PathWrapper {
+ fn as_ref(&self) -> &Path {
+ self.path.as_ref()
+ }
}
/// An alias for a glob iteration result.
@@ -355,10 +410,10 @@
// idx -1: was already checked by fill_todo, maybe path was '.' or
// '..' that we can't match here because of normalization.
if idx == !0 as usize {
- if self.require_dir && !is_dir(&path) {
+ if self.require_dir && !path.is_directory {
continue;
}
- return Some(Ok(path));
+ return Some(Ok(path.into_path()));
}
if self.dir_patterns[idx].is_recursive {
@@ -371,7 +426,7 @@
next += 1;
}
- if is_dir(&path) {
+ if path.is_directory {
// the path is a directory, so it's a match
// push this directory's contents
@@ -386,7 +441,7 @@
if next == self.dir_patterns.len() - 1 {
// pattern ends in recursive pattern, so return this
// directory as a result
- return Some(Ok(path));
+ return Some(Ok(path.into_path()));
} else {
// advanced to the next pattern for this path
idx = next + 1;
@@ -419,8 +474,8 @@
// *AND* its children so we don't need to check the
// children
- if !self.require_dir || is_dir(&path) {
- return Some(Ok(path));
+ if !self.require_dir || path.is_directory {
+ return Some(Ok(path.into_path()));
}
} else {
fill_todo(
@@ -469,10 +524,14 @@
///
/// - `*` matches any (possibly empty) sequence of characters.
///
-/// - `**` matches the current directory and arbitrary subdirectories. This
-/// sequence **must** form a single path component, so both `**a` and `b**`
-/// are invalid and will result in an error. A sequence of more than two
-/// consecutive `*` characters is also invalid.
+/// - `**` matches the current directory and arbitrary
+/// subdirectories. To match files in arbitrary subdiretories, use
+/// `**/*`.
+///
+/// This sequence **must** form a single path component, so both
+/// `**a` and `b**` are invalid and will result in an error. A
+/// sequence of more than two consecutive `*` characters is also
+/// invalid.
///
/// - `[...]` matches any character inside the brackets. Character sequences
/// can also specify ranges of characters, as ordered by Unicode, so e.g.
@@ -809,10 +868,10 @@
// special-casing patterns to match `.` and `..`, and avoiding `readdir()`
// calls when there are no metacharacters in the pattern.
fn fill_todo(
- todo: &mut Vec<Result<(PathBuf, usize), GlobError>>,
+ todo: &mut Vec<Result<(PathWrapper, usize), GlobError>>,
patterns: &[Pattern],
idx: usize,
- path: &Path,
+ path: &PathWrapper,
options: MatchOptions,
) {
// convert a pattern that's just many Char(_) to a string
@@ -828,7 +887,7 @@
Some(s)
}
- let add = |todo: &mut Vec<_>, next_path: PathBuf| {
+ let add = |todo: &mut Vec<_>, next_path: PathWrapper| {
if idx + 1 == patterns.len() {
// We know it's good, so don't make the iterator match this path
// against the pattern again. In particular, it can't match
@@ -840,8 +899,8 @@
};
let pattern = &patterns[idx];
- let is_dir = is_dir(path);
- let curdir = path == Path::new(".");
+ let is_dir = path.is_directory;
+ let curdir = path.as_ref() == Path::new(".");
match pattern_as_str(pattern) {
Some(s) => {
// This pattern component doesn't have any metacharacters, so we
@@ -855,7 +914,12 @@
} else {
path.join(&s)
};
- if (special && is_dir) || (!special && fs::metadata(&next_path).is_ok()) {
+ let next_path = PathWrapper::from_path(next_path);
+ if (special && is_dir)
+ || (!special
+ && (fs::metadata(&next_path).is_ok()
+ || fs::symlink_metadata(&next_path).is_ok()))
+ {
add(todo, next_path);
}
}
@@ -863,17 +927,22 @@
let dirs = fs::read_dir(path).and_then(|d| {
d.map(|e| {
e.map(|e| {
- if curdir {
+ let path = if curdir {
PathBuf::from(e.path().file_name().unwrap())
} else {
e.path()
- }
+ };
+ PathWrapper::from_dir_entry(path, e)
})
})
.collect::<Result<Vec<_>, _>>()
});
match dirs {
Ok(mut children) => {
+ if options.require_literal_leading_dot {
+ children
+ .retain(|x| !x.file_name().unwrap().to_str().unwrap().starts_with("."));
+ }
children.sort_by(|p1, p2| p2.file_name().cmp(&p1.file_name()));
todo.extend(children.into_iter().map(|x| Ok((x, idx))));
@@ -885,7 +954,7 @@
if !pattern.tokens.is_empty() && pattern.tokens[0] == Char('.') {
for &special in &[".", ".."] {
if pattern.matches_with(special, options) {
- add(todo, path.join(special));
+ add(todo, PathWrapper::from_path(path.join(special)));
}
}
}
@@ -1097,15 +1166,13 @@
// check windows absolute paths with host/device components
let root_with_device = current_dir()
.ok()
- .and_then(|p| {
- match p.components().next().unwrap() {
- Component::Prefix(prefix_component) => {
- let path = Path::new(prefix_component.as_os_str());
- path.join("*");
- Some(path.to_path_buf())
- }
- _ => panic!("no prefix in this path"),
+ .and_then(|p| match p.components().next().unwrap() {
+ Component::Prefix(prefix_component) => {
+ let path = Path::new(prefix_component.as_os_str());
+ path.join("*");
+ Some(path.to_path_buf())
}
+ _ => panic!("no prefix in this path"),
})
.unwrap();
// FIXME (#9639): This needs to handle non-utf8 paths
diff --git a/crates/glob/tests/glob-std.rs b/crates/glob/tests/glob-std.rs
index 085eb6d..4466413 100644
--- a/crates/glob/tests/glob-std.rs
+++ b/crates/glob/tests/glob-std.rs
@@ -15,7 +15,7 @@
extern crate glob;
extern crate tempdir;
-use glob::glob;
+use glob::{glob, glob_with};
use std::env;
use std::fs;
use std::path::PathBuf;
@@ -31,10 +31,40 @@
}
}
+ fn mk_symlink_file(original: &str, link: &str) {
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::symlink;
+ symlink(original, link).unwrap();
+ }
+ #[cfg(windows)]
+ {
+ use std::os::windows::fs::symlink_file;
+ symlink_file(original, link).unwrap();
+ }
+ }
+
+ fn mk_symlink_dir(original: &str, link: &str) {
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::symlink;
+ symlink(original, link).unwrap();
+ }
+ #[cfg(windows)]
+ {
+ use std::os::windows::fs::symlink_dir;
+ symlink_dir(original, link).unwrap();
+ }
+ }
+
fn glob_vec(pattern: &str) -> Vec<PathBuf> {
glob(pattern).unwrap().map(|r| r.unwrap()).collect()
}
+ fn glob_with_vec(pattern: &str, options: glob::MatchOptions) -> Vec<PathBuf> {
+ glob_with(pattern, options).unwrap().map(|r| r.unwrap()).collect()
+ }
+
let root = TempDir::new("glob-tests");
let root = root.ok().expect("Should have created a temp directory");
assert!(env::set_current_dir(root.path()).is_ok());
@@ -48,6 +78,10 @@
mk_file("bbb", true);
mk_file("bbb/specials", true);
mk_file("bbb/specials/!", false);
+ // a valid symlink
+ mk_symlink_file("aaa/apple", "aaa/green_apple");
+ // a broken symlink
+ mk_symlink_file("aaa/setsuna", "aaa/kazusa");
// windows does not allow `*` or `?` characters to exist in filenames
if env::consts::FAMILY != "windows" {
@@ -78,6 +112,22 @@
mk_file("r/three", true);
mk_file("r/three/c.md", false);
+ mk_file("dirsym", true);
+ mk_symlink_dir(root.path().join("r").to_str().unwrap(), "dirsym/link");
+
+ assert_eq!(
+ glob_vec("dirsym/**/*.md"),
+ vec!(
+ PathBuf::from("dirsym/link/another/a.md"),
+ PathBuf::from("dirsym/link/current_dir.md"),
+ PathBuf::from("dirsym/link/one/a.md"),
+ PathBuf::from("dirsym/link/one/another/a.md"),
+ PathBuf::from("dirsym/link/one/another/deep/spelunking.md"),
+ PathBuf::from("dirsym/link/three/c.md"),
+ PathBuf::from("dirsym/link/two/b.md")
+ )
+ );
+
// all recursive entities
assert_eq!(
glob_vec("r/**"),
@@ -91,6 +141,25 @@
)
);
+ // std-canonicalized windows verbatim disk paths should work
+ if env::consts::FAMILY == "windows" {
+ let r_verbatim = PathBuf::from("r").canonicalize().unwrap();
+ assert_eq!(
+ glob_vec(&format!("{}\\**", r_verbatim.display().to_string()))
+ .into_iter()
+ .map(|p| p.strip_prefix(&r_verbatim).unwrap().to_owned())
+ .collect::<Vec<_>>(),
+ vec!(
+ PathBuf::from("another"),
+ PathBuf::from("one"),
+ PathBuf::from("one\\another"),
+ PathBuf::from("one\\another\\deep"),
+ PathBuf::from("three"),
+ PathBuf::from("two")
+ )
+ );
+ }
+
// collapse consecutive recursive patterns
assert_eq!(
glob_vec("r/**/**"),
@@ -223,8 +292,10 @@
glob_vec("aaa/*"),
vec!(
PathBuf::from("aaa/apple"),
+ PathBuf::from("aaa/green_apple"),
+ PathBuf::from("aaa/kazusa"),
PathBuf::from("aaa/orange"),
- PathBuf::from("aaa/tomato")
+ PathBuf::from("aaa/tomato"),
)
);
@@ -232,6 +303,8 @@
glob_vec("aaa/*a*"),
vec!(
PathBuf::from("aaa/apple"),
+ PathBuf::from("aaa/green_apple"),
+ PathBuf::from("aaa/kazusa"),
PathBuf::from("aaa/orange"),
PathBuf::from("aaa/tomato")
)
@@ -262,6 +335,9 @@
assert_eq!(glob_vec("aaa/tomato/tomato.txt/"), Vec::<PathBuf>::new());
+ // Ensure to find a broken symlink.
+ assert_eq!(glob_vec("aaa/kazusa"), vec!(PathBuf::from("aaa/kazusa")));
+
assert_eq!(glob_vec("aa[a]"), vec!(PathBuf::from("aaa")));
assert_eq!(glob_vec("aa[abc]"), vec!(PathBuf::from("aaa")));
assert_eq!(glob_vec("a[bca]a"), vec!(PathBuf::from("aaa")));
@@ -288,6 +364,27 @@
vec!(PathBuf::from("bbb/specials/]"))
);
+ mk_file("i", true);
+ mk_file("i/qwe", true);
+ mk_file("i/qwe/.aaa", false);
+ mk_file("i/qwe/.bbb", true);
+ mk_file("i/qwe/.bbb/ccc", false);
+ mk_file("i/qwe/.bbb/.ddd", false);
+ mk_file("i/qwe/eee", false);
+
+ let options = glob::MatchOptions {
+ case_sensitive: false,
+ require_literal_separator: true,
+ require_literal_leading_dot: true,
+ };
+ assert_eq!(glob_with_vec("i/**/*a*", options), Vec::<PathBuf>::new());
+ assert_eq!(glob_with_vec("i/**/*c*", options), Vec::<PathBuf>::new());
+ assert_eq!(glob_with_vec("i/**/*d*", options), Vec::<PathBuf>::new());
+ assert_eq!(
+ glob_with_vec("i/**/*e*", options),
+ vec!(PathBuf::from("i/qwe"), PathBuf::from("i/qwe/eee"))
+ );
+
if env::consts::FAMILY != "windows" {
assert_eq!(
glob_vec("bbb/specials/[*]"),
diff --git a/pseudo_crate/Cargo.lock b/pseudo_crate/Cargo.lock
index 39eaecd..c21a5ab 100644
--- a/pseudo_crate/Cargo.lock
+++ b/pseudo_crate/Cargo.lock
@@ -2283,9 +2283,9 @@
[[package]]
name = "glob"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "googletest"
diff --git a/pseudo_crate/Cargo.toml b/pseudo_crate/Cargo.toml
index 419e9da..6bd61c3 100644
--- a/pseudo_crate/Cargo.toml
+++ b/pseudo_crate/Cargo.toml
@@ -129,7 +129,7 @@
gdbstub_arch = "=0.3.1"
getrandom = "=0.2.15"
glam = "=0.29.2"
-glob = "=0.3.1"
+glob = "=0.3.2"
googletest = "=0.11.0"
googletest_macro = "=0.13.0"
gpio-cdev = "=0.6.0"