Skip to content

Commit

Permalink
Fix broken symlink handling
Browse files Browse the repository at this point in the history
If a glob match includes a broken symlink we now emit an error.

Resolves #120
  • Loading branch information
rossmacarthur committed Jul 14, 2021
1 parent a831709 commit 8df07e3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,15 @@ impl ExternalPlugin {
.build()
.with_context(s!("failed to parse glob patterns: {}", debug()))?
{
files.push(
let entry = entry.with_context(s!("failed to match patterns: {}", debug()))?;
if entry.metadata()?.file_type().is_symlink() {
entry
.with_context(s!("failed to read path matched by patterns: {}", debug()))?
.into_path(),
);
.path()
.metadata()
.with_context(s!("failed to read symlink `{}`", entry.path().display()))
.with_context(s!("failed to match patterns: {}", debug()))?;
}
files.push(entry.into_path());
matched = true;
}
Ok(matched)
Expand Down

0 comments on commit 8df07e3

Please sign in to comment.