Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

cargo count dies if there are broken symlinks in tree #6

Closed
d3zd3z opened this issue Aug 22, 2015 · 2 comments
Closed

cargo count dies if there are broken symlinks in tree #6

d3zd3z opened this issue Aug 22, 2015 · 2 comments

Comments

@d3zd3z
Copy link

d3zd3z commented Aug 22, 2015

$ mkdir sample
$ cd sample
$ ln -s invalid foo
$ cargo count
Gathering information...
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:731

The culprit seems to be the calls to metadata in get_all_files, which will fail on a bogus symlink. Perhaps symlink_metadata would be better.

@kbknapp
Copy link
Owner

kbknapp commented Aug 22, 2015

Thanks for taking the time to file this! This should be an easy fix.

@kbknapp
Copy link
Owner

kbknapp commented Aug 25, 2015

This works now as cargo-count doesn't follow symlinks by default, but you can force it to by passing --follow-symlinks (or -S) and it shouldn't panic but instead function as expected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants