Comments (9)
Ha! Found the error! There is a file “/Users/gralpli/.cargo/registry/cache/.DS_Store” on my system that is indeed no directory.
The function cargo_cache::cache::registry_cache::RegistryCache::files
tries to fs::read_dir(&repo)
(line 90) on this file which results in the panic.
Maybe you want ignore files starting with a dot throughout your program?
from cargo-cache.
I get
thread '<unnamed>' panicked at 'Failed to read directory of file: '"/Users/jrmuizel/.cargo/git/checkouts/panopticon-c2636b8a03012228/c738b31/examples"'', src/cache/git_checkouts.rs:83:45
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::panicking::default_hook::{{closure}}
2: std::panicking::rust_panic_with_hook
3: std::panicking::continue_panic_fmt
4: std::panicking::begin_panic_fmt
5: cargo_cache::cache::git_checkouts::GitCheckoutCache::total_size::{{closure}}::{{closure}}
6: rayon::iter::plumbing::bridge_producer_consumer::helper
7: rayon_core::join::join_context::{{closure}}
8: rayon::iter::plumbing::bridge_producer_consumer::helper
9: rayon_core::join::join_context::{{closure}}
10: rayon::iter::plumbing::bridge_producer_consumer::helper
11: rayon_core::join::join_context::{{closure}}
12: rayon::iter::plumbing::bridge_producer_consumer::helper
13: rayon_core::join::join_context::{{closure}}
14: rayon::iter::plumbing::bridge_producer_consumer::helper
15: rayon_core::join::join_context::{{closure}}
16: rayon::iter::plumbing::bridge_producer_consumer::helper
17: <rayon_core::job::StackJob<L, F, R> as rayon_core::job::Job>::execute
18: rayon_core::registry::WorkerThread::wait_until_cold
/Users/jrmuizel/.cargo/git/checkouts/panopticon-c2636b8a03012228/c738b31/examples is symlink to an non existent file
from cargo-cache.
Thanks for the the ticket.
This is interesting, it's probably the unwrap()
of fs::read_dir(&self.path)
but I'm curious why this fails...
I'll add some debugging code later today so we can see what file this happens for.
from cargo-cache.
So, I added some checks to make sure files actually exist and are not dead symlinks for example before querying size.
Could you please check with the git version if your crashes still occur?
from cargo-cache.
That fixes it for me.
from cargo-cache.
Awesome!
Does something like cargo cache -t 10
also work?
from cargo-cache.
Yes.
from cargo-cache.
Great! Thanks a lot! :D
I'll try to get out another release in a couple of hours.
from cargo-cache.
The problem was that I assumed the some directories would only contain files and some would only contain directories, thus simply looping over the contents of a directory and getting the filesize of every item or the contents of every subdirectory.
However, this panicked when I tried to get the length of a file that was a dead symlink or if the directory I queried for its content was a regular file (as it happened with these .DS_Store
files.
The checks make sure that files are actually existing files and dirs are actually directories before proceeding. :)
from cargo-cache.
Related Issues (20)
- clean-unref: documentation & feat suggestion (recursivity) HOT 4
- cargo cache -a on a arm procesor HOT 3
- make sure http registry works
- Build failed with "error: failed to run custom build command for `libgit2-sys v0.12.26+1.3.0`" HOT 4
- cargo-cache toolchain panics HOT 3
- --keep-duplicate-crates seems to be partially broken HOT 4
- --keep-duplicate-crates version sorting not always correct
- cachepot support HOT 2
- Recompressing 'tree-sitter-haskell-74c278e7a2ef8d7d': 262.35 MB => HOT 4
- Odd wording HOT 1
- Date doesn't seem validated HOT 1
- gc: show number of seconds it took
- gc: compress multiple repos at a time (-j) HOT 2
- `cargo audit` issues found in the most recent crates.io release HOT 1
- build fails on Mac with MacPorts, because of libgit2 HOT 1
- Invalid size for installed binaries? HOT 1
- publish official binary releases HOT 2
- Semi-automatic dependency update with dependabot HOT 6
- `-g` and `-f` cannot be used together
- `-o`/`--remove-if-older-than` broken/wrongly triggers `-r`/`--remove-dir`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-cache.