BurntSushi / walkdir

Rust library for walking directories recursively.
The Unlicense
1.21k stars 106 forks source link

Panic in `push`: called `Option::unwrap()` on a `None` value #123

Closed LukasKalbertodt closed 4 years ago

LukasKalbertodt commented 4 years ago

I tried using cargo-sweep but it panics for me:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   8: rust_begin_unwind
             at src/libstd/panicking.rs:311
   9: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  10: core::panicking::panic
             at src/libcore/panicking.rs:49
  11: core::option::Option<T>::unwrap
             at /rustc/088b987307b91612ab164026e1dcdd0129fdb62b/src/libcore/macros.rs:12
  12: walkdir::IntoIter::push
             at /home/lukas/.cargo/registry/src/github.com-1ecc6299db9ec823/walkdir-2.2.6/src/lib.rs:875
  13: walkdir::IntoIter::handle_entry
             at /home/lukas/.cargo/registry/src/github.com-1ecc6299db9ec823/walkdir-2.2.6/src/lib.rs:845
  14: <walkdir::IntoIter as core::iter::traits::iterator::Iterator>::next
             at /home/lukas/.cargo/registry/src/github.com-1ecc6299db9ec823/walkdir-2.2.6/src/lib.rs:710
  15: cargo_sweep::find_cargo_projects
             at src/main.rs:83
  16: cargo_sweep::main
             at src/main.rs:223
  17: std::rt::lang_start::{{closure}}
             at /rustc/088b987307b91612ab164026e1dcdd0129fdb62b/src/libstd/rt.rs:64
  18: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  19: std::panicking::try::do_call
             at src/libstd/panicking.rs:296
  20: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:82
  21: std::panicking::try
             at src/libstd/panicking.rs:275
  22: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  23: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  24: std::rt::lang_start
             at /rustc/088b987307b91612ab164026e1dcdd0129fdb62b/src/libstd/rt.rs:64
  25: main

The problem seems to be this statement: https://github.com/BurntSushi/walkdir/blob/f85554d45938bc2c97f348549369e9ceef22e578/src/lib.rs#L898-L900

If I should try to find more information about the problem, just tell me!

BurntSushi commented 4 years ago

This is a duplicate of #118. If you can provide a reproduction, then I'd be happy to re-open #118. But as it stands, I see no way to reproduce this on my end. (What command did you run? On what directory? Can you reproduce it on a directory hierarchy that I can also see?)

LukasKalbertodt commented 4 years ago

@BurntSushi Thanks for the quick reply and sorry for not checking for dupes before! I will try to find a reproducible example and post it into #118.

BurntSushi commented 4 years ago

Thanks!