Skip to content

Commit 8df07e3

Browse files
committed
Fix broken symlink handling
If a glob match includes a broken symlink we now emit an error. Resolves #120
1 parent a831709 commit 8df07e3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/lock.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,15 @@ impl ExternalPlugin {
398398
.build()
399399
.with_context(s!("failed to parse glob patterns: {}", debug()))?
400400
{
401-
files.push(
401+
let entry = entry.with_context(s!("failed to match patterns: {}", debug()))?;
402+
if entry.metadata()?.file_type().is_symlink() {
402403
entry
403-
.with_context(s!("failed to read path matched by patterns: {}", debug()))?
404-
.into_path(),
405-
);
404+
.path()
405+
.metadata()
406+
.with_context(s!("failed to read symlink `{}`", entry.path().display()))
407+
.with_context(s!("failed to match patterns: {}", debug()))?;
408+
}
409+
files.push(entry.into_path());
406410
matched = true;
407411
}
408412
Ok(matched)

0 commit comments

Comments
 (0)