Giter Club home page Giter Club logo

Comments (17)

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024 2

Thanks again everyone!
Tests pass on windows now, and I have enabled travis ci windows jobs to make sure future breakage is noticed.

If you find something odd, please open a ticket. :)

from cargo-cache.

flip111 avatar flip111 commented on June 19, 2024

what should be tested about this ?

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

Make sure the output of
cargo cache
cargo cache --autoclean-expensive --dry-run
cargo cache --info
cargo cache --list-dirs
cargo cache --top-cache-items 10
look ok (and there are no panics).

Maybe run tests (I assume this will fail since I have never done this before)

from cargo-cache.

idursun avatar idursun commented on June 19, 2024

It does show the sizes alright but autoclean has failed with a permission problem. It fails also in the elevated mode (admin) as well.

Total size:                             861.16 MB
Size of 21 installed binaries:            147.52 MB
Size of registry:                         668.09 MB
Size of 673 crate archives:                 66.05 MB
Size of 673 crate source checkouts:         398.16 MB
Size of git db:                           45.56 MB
Size of 4 bare git repos:                   20.85 MB
Size of 4 git repo checkouts:               24.71 MB
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 5, kind: PermissionDenied, message: "Access is denied." }', libcore\result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

back trace is not very useful but here it goes:

stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: git_hashsig_create_fromfile
  10: BaseThreadInitThunk
  11: RtlUserThreadStart

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

Err, I would not run this as admin.. :D
It's strange that there is no backtrace.
Is this a release build?

from cargo-cache.

idursun avatar idursun commented on June 19, 2024

Yes, it was a release build.

I have cloned the repo and run it and here is the stack trace:

d:\repositories\rust\cargo-cache>cargo run --bin cargo-cache -- -a
    Finished dev [unoptimized + debuginfo] target(s) in 9.80s
     Running `target\debug\cargo-cache.exe -a`
Cargo cache 'C:\Users\Ibrahim.Dursun\.cargo/':

Total size:                             308.22 MB
Size of 16 installed binaries:            147.96 MB
Size of registry:                         115.65 MB
Size of 129 crate archives:                 14.41 MB
Size of 129 crate source checkouts:         75.87 MB
Size of git db:                           44.62 MB
Size of 3 bare git repos:                   19.92 MB
Size of 4 git repo checkouts:               24.70 MB
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 5, kind: PermissionDenied, message: "Access is denied." }', libcore\result.rs:1009:5
stack backtrace:
   0: std::sys::windows::backtrace::set_frames
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\sys\windows\backtrace\mod.rs:104
   1: std::sys::windows::backtrace::set_frames
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\sys\windows\backtrace\mod.rs:104
   2: std::sys_common::backtrace::_print
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\sys_common\backtrace.rs:71
   3: std::sys_common::backtrace::_print
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\sys_common\backtrace.rs:71
   4: std::panicking::default_hook::{{closure}}
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:211
   5: std::panicking::default_hook
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:227
   6: std::panicking::rust_panic_with_hook
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:476
   7: std::panicking::continue_panic_fmt
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:390
   8: std::panicking::rust_begin_panic
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:325
   9: core::panicking::panic_fmt
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libcore\panicking.rs:77
  10: core::result::unwrap_failed<std::io::error::Error>
             at \libcore\macros.rs:26
  11: core::result::Result<(), std::io::error::Error>::unwrap<(),std::io::error::Error>
             at \libcore\result.rs:808
  12: cargo_cache::main
             at .\src\main.rs:135
  13: std::rt::lang_start::{{closure}}<()>
             at \libstd\rt.rs:74
  14: std::rt::lang_start_internal::{{closure}}
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\rt.rs:59
  15: std::rt::lang_start_internal::{{closure}}
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\rt.rs:59
  16: panic_unwind::__rust_maybe_catch_panic
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libpanic_unwind\lib.rs:102
  17: std::panicking::try
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:289
  18: std::panicking::try
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:289
  19: std::panicking::try
             at /rustc/abe02cefd6cd1916df62ad7dc80161bea50b72e8\src/libstd\panicking.rs:289
  20: std::rt::lang_start<()>
             at \libstd\rt.rs:74
  21: main
  22: invoke_main
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  23: invoke_main
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  24: BaseThreadInitThunk
  25: RtlUserThreadStart
error: process didn't exit successfully: `target\debug\cargo-cache.exe -a` (exit code: 101)

from cargo-cache.

idursun avatar idursun commented on June 19, 2024

@matthiaskrgr I have run the command with dry-run to see what directories would be removed and here is the output.

d:\repositories\rust\cargo-cache>cargo run --bin cargo-cache -- -a --dry-run
    Finished dev [unoptimized + debuginfo] target(s) in 0.85s
     Running `target\debug\cargo-cache.exe -a --dry-run`
Cargo cache 'C:\Users\Ibrahim.Dursun\.cargo/':

Total size:                             308.82 MB
Size of 16 installed binaries:            147.96 MB
Size of registry:                         116.24 MB
Size of 132 crate archives:                 14.64 MB
Size of 132 crate source checkouts:         76.24 MB
Size of git db:                           44.62 MB
Size of 3 bare git repos:                   19.92 MB
Size of 4 git repo checkouts:               24.70 MB
would remove directory 'C:\Users\Ibrahim.Dursun\.cargo\registry/src/'
would remove directory 'C:\Users\Ibrahim.Dursun\.cargo\git/checkouts/'

I think this is happening because of the mixed up back and forward slashes.

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

Oooooh, that sounds plausible. I'll have a look

from cargo-cache.

idursun avatar idursun commented on June 19, 2024

@matthiaskrgr

Offending directory is the second one C:\Users\Ibrahim.Dursun\.cargo\git/checkouts/ and back or forward slashes don't cause the problem.

If there are readonly files in the directory then the fs::remove_all_dir call panicks.

let pf = PathBuf::from("D:\\something\\");
let _ = fs::remove_dir_all(&pf).unwrap();

Create a readonly file inside the something folder to reproduce.

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

It might be that git sets its internal files as read-only ( to prevent accidental deletion) and we are choking on those on windows...

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

@idursun so the crash was happening in --autoclean when fs::remove_dir::all() failed to delete a directory.
For now I have added a small debug message that will pop up if that happens (it will still panic though).
3783607

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

I'm wondering what the best solution would be...
We could

  • panic as currently (probably not the best solution)
  • print a warning on every file that could not be deleted
  • silently ignore failures to delete files

It would help to know what kind of files could not be deleted properly.

from cargo-cache.

Eh2406 avatar Eh2406 commented on June 19, 2024

I was pleasantly surprised to discover that cargo-sweep does the print a warning on every file that could not be deleted.

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

Ok, we should now get a warning on every file that could not be deleted (I hope this is not too spammy) but continue execution if possible. 👍
183ee36

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

The inconsistent paths should be fixed with 682fbe4

from cargo-cache.

idursun avatar idursun commented on June 19, 2024

@matthiaskrgr I think it is the most reasonable thing to do at the moment. Thanks for the fix.

from cargo-cache.

matthiaskrgr avatar matthiaskrgr commented on June 19, 2024

Please let me know if there's anything else that seems odd! :)

from cargo-cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.